@askbills/util
v1.0.1
Published
collection of utility functions support validation
Downloads
9
Maintainers
Readme
Introduction
Supports validating input data.
Capabilities and Frameworks
|Capability|Module|
|------------------|-----------|
|Coding Standard|eslint identifying and reporting on patterns found in ECMAScript/JavaScript code completely pluggable, babel-eslint support parsing ECMAScript for eslint|
|Testing Framework| lab nodejs test framework uses domains instead of uncaught exception and other global manipulation|
How to test
npm test
npm test:coverageHow to check lint
npm run lint
npm run lintFixHow to use
Install this module
npm install @askbills/util --saveChecking input value
const { Checking } = require('@askbills/util');
const inputValue = true;
if !(Checking.isBoolean(inputValue)) {
return;
}
doSomeThing();ThrowError if condition doesn't match
const { Exception } = require('@askbills/util');
const inputValue = true;
try {
Exception.throwIfNotBoolean(inputValue, 'required Boolean');
doSomeThing();
} catch (e) {
console.log('required Boolean');
}