https://github.com/chinanf-boy/validate-switch
全局验证开关 global Validate data Switch , a thing
https://github.com/chinanf-boy/validate-switch
global switch validata
Last synced: about 1 year ago
JSON representation
全局验证开关 global Validate data Switch , a thing
- Host: GitHub
- URL: https://github.com/chinanf-boy/validate-switch
- Owner: chinanf-boy
- License: mit
- Created: 2018-05-01T04:04:39.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-27T14:41:37.000Z (about 8 years ago)
- Last Synced: 2025-03-12T09:40:33.271Z (over 1 year ago)
- Topics: global, switch, validata
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.en.md
- License: license
Awesome Lists containing this project
README
# Validate-switch[](https://travis-ci.org/chinanf-boy/validate-switch) [](https://codecov.io/gh/chinanf-boy/validate-switch?branch=master)
> Global verification switch
[Chinese](./readme.md)Ɯ[English](./readme.en.md)
As a command line - the most important and only validation from the user`Uncertain input`
Once we determine that the value given by the user is`correct`
Well, located in a large cli, underneath`Function function`You can be sure that the parameters given to them are correct
Let's filter out the function-validation section, so sooner sooner?
Why ????
Because we can already control 吖
* * *
## Ideas
`Function function` is divided into two operations
1. As a base for cli`No need to verify data`
2. Self function - verification project`Need to verify the data`
Say it, that is related`verify the data`- Operation is filtered out, so one`switch`, born
Simple adoption`Validate-switch`
```js
if(getValidate().state){ // default: true
// includes📦
// validate data etc ...
}
```
> `Validate-switch`Is nothing to do, just global val return
>
> The most important thing is that you, who control the change of data, regardless of the success or failure of the process, should be controllable.
>
> I think this is the idea that this project wants to transmit
* * *
## Install
npm install validate-switch
yarn add validate-switch
## Usage
```js
const validateSwitch = require('validate-switch');
```
## Api
### 1. superstruct
From[Https://github.com/ianstormtaylor/superstruct](https://github.com/ianstormtaylor/superstruct)
> A simple and combinable way to validate data in javascript.
### 2. setvalidate(input)
#### Input
Type:`Boolean`
### 3. getvalidate : return {state}
#### State
Type:`Boolean`
### 4. togglevalidate : return {state}
#### State
Type:`Boolean`
* * *
## License
Mit ©[Chinanf-boy](http://llever.com)