This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

yuppers

0.2.0 • Public • Published

yuppers npm version

a simple function to help generate yup validation schema

❗️ CAUTION

Quickly threw this together; only supports string and number data types

😎 INSTALL

$ yarn add yuppers

🔥 USAGE

Pass in a schema similar to something below:

const schema = {
  // ...form properties
  fields: [
    {
      key: 'name',
      // ...other field properties
      dataType: 'string',
      validations: [
        {
          type: 'min',
          value: 5,
          message: 'Must have at least 5 chars'
        }
      ]
    },
    {
      key: 'password',
      // ...other field properties
      dataType: 'string',
      required: true,
      validations: [
        {
          type: 'min',
          value: 8,
          message: 'Must have at least 8 chars'
        }
      ]
    }
  ]
}

like so: validationBuilder(schema.fields)

to get:

yup.object().shape({
  name: yup.string().min(5, 'Must have at least 5 chars'),
  password: yup
    .string()
    .min(8, 'Must have at least 8 chars')
    .required()
})

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i yuppers

Weekly Downloads

3

Version

0.2.0

License

MIT

Unpacked Size

27.5 kB

Total Files

19

Last publish

Collaborators

  • phoker