Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@flipbyte/yup-schema

flipbyte2.6kMIT0.1.5

Easily define your yup rules using arrays instead of yup object

yup-schema, yup-json, yup-array, yup-object, yup, yup-validation

readme

yup-schema

Developed by Flipbyte

Build Status npm package Coverage Status license Codacy Badge

yup-schema is a simple library that allows you to write yup rules using arrays.

Installation

npm i @flipbyte/yup-schema

Usage

The library considers each yup method to be an array within a main array, with method name as the first value, followed by the arguments (if any).

Example

yup.object().shape({
    name: yup.string().required(),
    age: yup.number().min(18)
})

would become

[['object'], ['shape', {
    name: [['string'], ['required']],
    age: [['number'], ['min', 18]]
}]]

License

The MIT License (MIT)