basetype
Provide basic type validation functions and simple type composition.
install
npm i basetype --save
type function
Type function is a boolean function, accept one argument and return boolean value.
eg:
let likeArray = ; ; // => false; // => true
basic types
isUndefined isNull isFalsy likeArray isString isObject isFunction isNumber isBool isNode isPromise isReadableStream isWritableStream
compose types
- and
let newType = ;; // true; // false
- or
let newType = ;; // true; // true; // false
- not
let newType = ;; // false; // true
- mapType
let type = ; ; //true ; //false
- listType
let type = ;; //true; //false
- any
; //true; //false
- exist
; //false; // true
function arguments type
let fun = ; ; // 3; // TypeError