https://github.com/flipbyte/yup-schema
Easily define your yup rules using arrays instead of yup object
https://github.com/flipbyte/yup-schema
array-to-yup yup-array yup-config yup-json yup-json-array
Last synced: 5 months ago
JSON representation
Easily define your yup rules using arrays instead of yup object
- Host: GitHub
- URL: https://github.com/flipbyte/yup-schema
- Owner: flipbyte
- License: mit
- Created: 2019-02-15T04:53:48.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-09-07T02:19:51.000Z (almost 5 years ago)
- Last Synced: 2025-09-20T19:18:39.001Z (9 months ago)
- Topics: array-to-yup, yup-array, yup-config, yup-json, yup-json-array
- Language: JavaScript
- Homepage:
- Size: 521 KB
- Stars: 6
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# yup-schema
[Developed by Flipbyte](https://www.flipbyte.com/)
[![Build Status][build-badge]][build]
[![npm package][npm-badge]][npm]
[![Coverage Status][coveralls-badge]][coveralls]
[![license][license-badge]][license]
[![Codacy Badge][codacy-badge]][codacy]
yup-schema is a simple library that allows you to write yup rules using arrays.
## Installation
```sh
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
```js
yup.object().shape({
name: yup.string().required(),
age: yup.number().min(18)
})
```
would become
```js
[['object'], ['shape', {
name: [['string'], ['required']],
age: [['number'], ['min', 18]]
}]]
```
## License
The MIT License (MIT)
[build-badge]: https://travis-ci.org/flipbyte/yup-schema.svg?branch=master
[build]: https://travis-ci.org/flipbyte/yup-schema
[npm-badge]: https://img.shields.io/npm/v/@flipbyte/yup-schema.svg
[npm]: https://www.npmjs.com/package/@flipbyte/yup-schema
[coveralls-badge]: https://coveralls.io/repos/github/flipbyte/yup-schema/badge.svg
[coveralls]: https://coveralls.io/github/flipbyte/yup-schema
[license-badge]: https://badgen.now.sh/badge/license/MIT
[license]: ./LICENSE
[codacy-badge]: https://api.codacy.com/project/badge/Grade/1352a47a773b4d49b3b3d6956417ba2a
[codacy]: https://www.codacy.com/app/flipbyte/yup-schema?utm_source=github.com&utm_medium=referral&utm_content=flipbyte/yup-schema&utm_campaign=Badge_Grade