1.0.1 • Published 6 years ago

@askbills/util v1.0.1

Weekly downloads
1
License
ISC
Repository
gitlab
Last release
6 years ago

Introduction

Supports validating input data.

Capabilities and Frameworks

CapabilityModule
Coding Standardeslint identifying and reporting on patterns found in ECMAScript/JavaScript code completely pluggable, babel-eslint support parsing ECMAScript for eslint
Testing Frameworklab nodejs test framework uses domains instead of uncaught exception and other global manipulation

How to test

npm test
npm test:coverage

How to check lint

npm run lint
npm run lintFix

How to use

Install this module

npm install @askbills/util --save

Checking 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');
}