toxic-predicate-functions
predicate functions collection
get started
npm install toxic-predicate-functions --save
if you are using flow
, you should import our flow defination, by adding this to your .flowconfig
.
[ignore]
[include]
[libs]
./node_modules/toxic-predicate-functions/lib/index.flow.js
[options]
[lints]
doc
defined
src/index.js:5-7
to check whether the object is defined or not
Parameters
Returns boolean
isVoid
src/index.js:11-13
is void element or not ? Means it will return true when val is undefined or null
Parameters
Returns boolean
isArray
src/index.js:17-19
to check whether a variable is array
Parameters
Returns boolean
isFunction
src/index.js:24-26
is it a function or not
Parameters
Returns boolean
isObject
src/index.js:31-34
is it an object or not
Parameters
Returns boolean
isNumber
src/index.js:38-40
to tell you if it's a real number
Parameters
Returns boolean
isNumeric
src/index.js:44-46
to tell you if the val can be transfer into number
Parameters
Returns boolean
isInteger
src/index.js:50-52
is it an interget or not
Parameters
Returns boolean
isEmpty
src/index.js:57-65
return true when the value is "", {}, [], 0, null, undefined, false.
Parameters
Returns boolean
isEvent
src/index.js:69-71
is it an event or not
Parameters
Returns boolean
isBlob
src/index.js:75-77
is it a blob
Parameters
Returns boolean
isFile
src/index.js:81-83
is it a file uploaded by user through file inpue
Parameters
Returns boolean
isDate
src/index.js:87-89
is it a date
Parameters
Returns boolean
isString
src/index.js:93-96
is it a string
Parameters
Returns boolean
isBoolean
src/index.js:100-102
is Boolean or not
Parameters
Returns boolean
isPromise
src/index.js:106-108
is a promise or not
Parameters
Returns boolean
isPrimitive
src/index.js:112-114
is Primitive type or not, whick means it will return true when data is number/string/boolean/undefined/null
Parameters
Returns boolean
isUrl
src/index.js:118-120
is it an url, but this test require the url to have an protocol
Parameters
Returns boolean
isNode
src/index.js:124-131
to test if a HTML node
Parameters
Returns boolean
isElement
src/index.js:135-143
to test if a HTML element
Parameters
Returns boolean
isChildNode
src/index.js:147-152
check if node A is node B's parent or not
Parameters
Returns boolean
isPosterityNode
src/index.js:156-167
check if node B is node A's posterrity or not
Parameters
Returns boolean
isHTMLString
src/index.js:171-173
check if the string is an HTMLString
Parameters
Returns boolean
isError
src/index.js:177-179
check if is an error
Parameters
Returns boolean
isRegExp
src/index.js:183-185
check if is an RegExp
Parameters
Returns boolean