schm-computed
v0.4.1
Published
Adds computed parameters to schm schemas
Downloads
266
Readme
schm-computed
Adds computed parameters to schm
schemas.
Install
$ npm install --save schm-computed
Usage
const schema = require('schm')
const computed = require('schm-computed')
const userSchema = schema({
firstName: String,
lastName: String,
}, computed({
fullName: values => `${values.firstName} ${values.lastName}`,
}))
userSchema.parse({
firstName: 'Diego',
lastName: 'Haz'
})
Output:
{
firstName: 'Diego',
lastName: 'Haz',
fullName: 'Diego Haz'
}
API
Table of Contents
computed
Add computed parameters to schema.
Parameters
params
Object
License
MIT © Diego Haz