@cbevins/behaveplus-validate-parms
v0.1.1
Published
BehavePlus function parameter validation methods
Downloads
3
Maintainers
Readme
behaveplus-validate-parms
BehavePlus method parameter validation methods.
Description
The behaveplus-validate-parms package is used by all the other behaveplus-* packages to ensure the correct number and type of parameters are being passed. If the espected function signature is not met, an exception is thrown, enforcing the concept of 'fail fast' with respect to programmer errors.
Because constant repetitive parameter validation may impact performance in production environments, each of the behaveplus-* packages contain the following functions:
- enableParamaterValidation()
- disableParameterValidation()
Each behaveplus-* module performs parameter validation by default, and all the test files require parameter validation to occur. But in well-tested production environments, the client may call [module].disableParameterValidation() to improve performance.
Methods
isNumber(name, value)
isNumberBetween(name, value, minValue, maxValue)
isNumberGe(name, value, minValue)
isNumberGt(name, value, minValue)
isNumberInRange(name, value, minValue, maxValue)
isNumberLe(name, value, maxValue)
isNumberLt(name, value, maxValue)
isString(name, value)
isStringInSet(name, value, setArray)