schm-translate

0.4.1 • Public • Published

schm-translate

NPM version

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: [
    'hazdiego@gmail.com',
    'diegohaz@live.com',
  ],
})

Output:

{
  name: 'Haz',
  email: 'hazdiego@gmail.com',
}

API

Table of Contents

translate

Translates values keys to schema keys.

Parameters

License

MIT © Diego Haz

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.4.179latest

Version History

VersionDownloads (Last 7 Days)Published
0.4.179
0.1.62
0.1.50
0.1.40
0.1.30
0.1.20
0.1.10
0.1.00
0.0.71
0.0.60
0.0.50
0.0.40
0.0.30
0.0.20

Package Sidebar

Install

npm i schm-translate

Weekly Downloads

82

Version

0.4.1

License

MIT

Unpacked Size

5.23 kB

Total Files

5

Last publish

Collaborators

  • diegohaz