Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 1.06 KB

README.md

File metadata and controls

52 lines (33 loc) · 1.06 KB

schm-methods

NPM version

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

License

MIT © Diego Haz