Narnia's Poofy Meatcleaver

    schm-computed

    0.4.1 • Public • Published

    schm-computed

    NPM version

    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

    License

    MIT © Diego Haz

    Keywords

    Install

    npm i schm-computed

    DownloadsWeekly Downloads

    57

    Version

    0.4.1

    License

    MIT

    Unpacked Size

    4.32 kB

    Total Files

    5

    Last publish

    Collaborators

    • diegohaz