model-schema

0.0.2 • Public • Published

model-schema

A plugin that creates a model's attributes from a schema.

Installation

$ component install segmentio/model-schema
$ npm install model-schema

Example

var model = require('model');
var schema = require('model-schema');
 
var json = {
  id: {
    type: 'string',
    required: true,
    validators: [Function, Function]
  },
  name: {
    type: 'string',
    validators: [Function]
  }
};
 
var User = model()
  .use(schema(json));

API

schema(json)

Return the plugin function for a given json schema.

/model-schema/

    Package Sidebar

    Install

    npm i model-schema

    Weekly Downloads

    1

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • dfcreative
    • juliangruber
    • segmentio
    • ianstormtaylor