0.1.0 • Published 7 years ago

vapi v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

vapi

Package Quality npm

A javascript library that helps you create models in your applications.

Quick Start

Using npm:

$ npm install --save vapi

In Node.js:

// /app/models/MyModel.js
const {Model} = require('vapi')

Documentation

Quick Examples

class Person extends Model {}
// Define properties to Person model.
Person.defineProperty('first', { alias: 'name' })
Person.defineProperty('name', {
    transform: require('lodash/toLower')
})

class User extends Model {}
// Define properties to User model.
User.defineProperties({
    'username': {
        transform: require('lodash/toLower')
    },
    'password': {
        validation: (v) => /^[a-z|0-9]{9,15}$/.test(v)
    },
    'person': {}
})

// Create an instance of the User model.
const cat = new User({
    username: 'UserA',
    password: '1234', // Bad Password
    person: new Person({
        name: 'Julio'
    })
})

// Validation
if (cat.isValid()) {
    // you code if is valid.
} else {
    // you code of is not valid.
}

// End Cat state
// cat => 
// {
//   "username": "usera",
//   "password": "1234",
//   "person": {
//     "first": "julio",
//     "name": "julio"
//   }
// }

Brand Vapi

Vapi (Virtual API) is an open brand whereby this not have a restriction in you use. However it is suggested to use this with the following specifications.

  • Use the name Vapi:
    • Vapi: The first letter uppercase.
    • vapi: all letters on lowercase.
    • vapi.js: Specific the javascript extension.

License

This project is under a MIT License.

0.1.0

7 years ago

0.1.0-beta.3

7 years ago

0.1.0-beta.2

7 years ago

0.1.0-beta.1

7 years ago

0.1.0-beta.0

7 years ago

0.1.0-alpha.0

7 years ago

0.0.0-alpha.23

7 years ago

0.0.0-alpha.22

7 years ago

0.0.0-alpha.20

7 years ago

0.0.0-alpha.19

7 years ago

0.0.0-alpha.18

7 years ago

0.0.0-alpha.16

7 years ago

0.0.0-alpha.15

7 years ago

0.0.0-alpha.14

7 years ago

0.0.0-alpha.13

7 years ago

0.0.0-alpha.12

7 years ago

0.0.0-alpha.11

7 years ago

0.0.0-alpha.10

7 years ago

0.0.0-alpha.9

7 years ago

0.0.0-alpha.8

7 years ago

0.0.0-alpha.7

7 years ago

0.0.0-alpha.6

7 years ago

0.0.0-alpha.5

7 years ago

0.0.0-alpha.4

7 years ago

0.0.0-alpha.3

7 years ago

0.0.0-alpha.2

7 years ago

0.0.0-alpha.1

7 years ago

0.0.0-alpha.0

7 years ago