schm-translate
v0.4.1
Published
Translates values keys into schema keys
Downloads
304
Readme
schm-translate
Translates values keys to schema keys.
Install
$ npm install --save schm-translate
Usage
const schema = require('schm')
const translate = require('schm-translate')
const userSchema = schema({
name: String,
email: String,
}, translate({
name: 'username',
email: 'emails.0',
}))
const user = userSchema.parse({
username: 'Haz',
emails: [
'[email protected]',
'[email protected]',
],
})
Output:
{
name: 'Haz',
email: '[email protected]',
}
API
Table of Contents
translate
Translates values keys to schema keys.
Parameters
params
Object
License
MIT © Diego Haz