Git Product home page Git Product logo

dbjs-ext's Introduction

dbjs-ext

Common type extensions for dbjs engine

Installation

$ npm install dbjs-ext

To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: Browserify, Webmake or Webpack

Provided types

List of extensions is not closed and is still being completed.

  • DateTime
    • Date - Date, where time is not applicable. Date is saved against UTC time-zone, and it's guaranteed to produce same dates in any time-zone application is run
  • Number
    • Currency - Abstract currency type, should be used only to create specific currency types
      • ArgentinePeso - Argentine Peso
      • CfaFranc - CFA Franc
      • GuatemalanQuetzal - Guatemalan Quetzal
      • UsDollar - US Dollar
      • TzsDollar - Tanzania Dollar
    • HorsePower - Horsepower unit
    • Integer - Integer
      • UInteger - Unsigned integer (technically just positive integer)
        • Time - Time (milliseconds between 0:00:00.000 and 23:59:59.000)
    • Percentage - Percentage
    • SquareMeters - Square meters
  • Object
    • DateTimeRange - Time Range
    • File - Computer file
      • ImageFile - Image file
        • JpegFile - JPG file
        • PngFile - PNG file
      • MsWordFile - MS Word file
        • MsWordDocFile - MS Word .doc file
        • MsWordDocxFile - MS Word .docx file
      • PdfFile - PDF file
    • OneDayTimeRange - Time Range within one day
  • String
    • StringLine - String line (string with no new-line characters)
      • Country - Country
      • Email - Email
      • Filename - Computer filename
      • Gender - Gender (male/female)
      • MimeTypeGroup - Mime type group
        • MimeType - Mime type
      • Password - Password
      • Sha256Hash - Sha256Hash
      • Url - Url

Usage

var Database = require('dbjs');
var db = new Database();
require('dbjs-ext/string/string-line/email')(db)
require('dbjs-ext/string/string-line/password')(db);

Db.Object.create('User', {
  email: { type: db.Email, required: true },
  password: { db.Password, required: true }
});

Tests

$ npm test

dbjs-ext's People

Contributors

medikoo avatar mtuchowski avatar kamsi avatar

Stargazers

Mehdi Baneshi avatar Mikey avatar  avatar

Watchers

 avatar James Cloos avatar  avatar  avatar

dbjs-ext's Issues

Modularize package

We should have dedicated packages for

  • Date (Date, and possibly other time related utilities)
    • Additionaly for Date type, we should fix all native methods (e.g. make getDate to return result of getUTCDate etc)
  • Geo (countries, provinces etc)
  • Currency (all types of currencies)
  • File (all types of files)
  • String (all basic string types)
  • Number (all basic number types)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.