schm-methods
v0.4.1
Published
Adds methods to schm parsed objects
Downloads
270
Readme
schm-methods
Adds methods to schm
parsed objects.
Install
$ npm install --save schm-methods
Usage
const schema = require('schm')
const methods = require('schm-methods')
const userSchema = schema({
name: String,
preferredLanguages: [String],
}, methods({
codeIn: (values, language) => values.preferredLanguages.includes(language),
}))
const user = userSchema.parse({
name: 'Haz',
preferredLanguages: ['JavaScript', 'Swift', 'C#'],
})
user.codeIn('JavaScript') // true
user.codeIn('Java') // false
API
Table of Contents
methods
Adds methods to schm parsed object.
Parameters
params
Object
License
MIT © Diego Haz