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
to check whether the object is defined or not
Parameters
obj
any
Returns boolean
isVoid
is void element or not ? Means it will return true when val is undefined or null
Parameters
obj
any
Returns boolean
isArray
to check whether a variable is array
Parameters
arr
any
Returns boolean
isFunction
is it a function or not
Parameters
obj
any
Returns boolean
isObject
is it an object or not
Parameters
obj
any
Returns boolean
isNumber
to tell you if it's a real number
Parameters
obj
any
Returns boolean
isNumeric
to tell you if the val can be transfer into number
Parameters
obj
any
Returns boolean
isInteger
is it an interget or not
Parameters
num
any
Returns boolean
isEmpty
return true when the value is "", {}, [], 0, null, undefined, false.
Parameters
obj
any
Returns boolean
isEvent
is it an event or not
Parameters
obj
any
Returns boolean
isBlob
is it a blob
Parameters
obj
any
Returns boolean
isFile
is it a file uploaded by user through file inpue
Parameters
obj
any
Returns boolean
isDate
is it a date
Parameters
obj
any
Returns boolean
isString
is it a string
Parameters
str
any
Returns boolean
isBoolean
is Boolean or not
Parameters
bool
any
Returns boolean
isPromise
is a promise or not
Parameters
obj
any
Returns boolean
isPrimitive
is Primitive type or not, whick means it will return true when data is number/string/boolean/undefined/null
Parameters
val
any
Returns boolean
isUrl
is it an url, but this test require the url to have an protocol
Parameters
str
any
Returns boolean
isNode
to test if a HTML node
Parameters
obj
any
Returns boolean
isElement
to test if a HTML element
Parameters
obj
any
Returns boolean
isChildNode
check if node A is node B's parent or not
Parameters
Returns boolean
isPosterityNode
check if node B is node A's posterrity or not
Parameters
Returns boolean
isHTMLString
check if the string is an HTMLString
Parameters
str
string
Returns boolean
isError
check if is an error
Parameters
val
any
Returns boolean
isRegExp
check if is an RegExp
Parameters
val
any
Returns boolean