5.2.0 • Published 5 years ago
@typemon/check v5.2.0
Check -

A collection of frequently used, safe and intuitive type checking and comparison functions. Resolve inconsistencies between global functions and methods of primitive wrapper objects. You no longer need to write duplicate code or use exclamation marks. It provides the most basic functionality without dependencies, so you don't have to worry about overhead or code size. Fully integrated with the TypeScript type system, you can expect high productivity.
Features
Each function is well documented through comments. It is also easy to understand because it is linked to MDN documents.
equal, notEqualless, lessOrEqualgreater, greaterOrEqualisIn, isNotIninstanceOf, notInstanceOfisBoolean, isNotBooleanisTrue, isNotTrueisFalse, isNotFalseisTruthy, isFalsyisString, isNotStringisNumber, isNotNumberisNaN, isNotNaNisFinite, isInfiniteisInteger, isNotIntegerisFloat, isNotFloatisUndefined, isNotUndefinedisNull, isNotNullisUndefinedOrNull, isNotUndefinedAndNotNullisSymbol, isNotSymbolisFunction, isNotFunctionisObject, isNotObjectisArray, isNotArrayisConstructor, isNotConstrutorisIterable, isNotIterableisAsyncIterable, isNotAsyncIterable
Installation
$ npm install @typemon/checkUsage
import { Check } from '@typemon/check';const value: boolean | number | string | . . . = generateValue();
if (Check.isBoolean(value)) {
. . .
}
else if (Check.isNumber(value)) {
. . .
}
else {
. . .
}const value: Example | typeof Example = generateValue();
if (Check.isConstructor(value)) {
. . .
}
else {
. . .
}