validate-switch
v0.0.3
Published
全局验证开关 global Validate data Switch , a thing
Downloads
3
Readme
Validate-switch
Global verification switch
As a command line - the most important and only validation from the userUncertain input
Once we determine that the value given by the user iscorrect
Well, located in a large cli, underneathFunction 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
As a base for cli
No need to verify data
Self function - verification project
Need to verify the data
Say it, that is relatedverify the data
- Operation is filtered out, so oneswitch
, born
Simple adoptionValidate-switch
if(getValidate().state){ // default: true
// includes📦
// validate data etc ...
}
Validate-switch
Is nothing to do, just global val returnThe 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
const validateSwitch = require('validate-switch');
Api
1. superstruct
FromHttps://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