Adds methods to schm
parsed objects.
$ npm install --save schm-methods
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
Adds methods to schm parsed object.
params
Object
MIT © Diego Haz