Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/model-schema
A plugin that creates a model's attributes from a schema.
https://github.com/component/model-schema
Last synced: 13 days ago
JSON representation
A plugin that creates a model's attributes from a schema.
- Host: GitHub
- URL: https://github.com/component/model-schema
- Owner: component
- Created: 2014-01-20T10:10:48.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-20T10:10:54.000Z (almost 11 years ago)
- Last Synced: 2024-05-08T17:10:54.590Z (8 months ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 3
- Watchers: 9
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# model-schema
A plugin that creates a model's attributes from a schema.
## Installation
$ component install segmentio/model-schema
$ npm install model-schema## Example
```js
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.