0.4.2 • Published 5 years ago

toxic-predicate-functions v0.4.2

Weekly downloads
173
License
MIT
Repository
github
Last release
5 years ago

toxic-predicate-functions

Build Status Coverage Status npm dependency Status devDependency Status

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

isVoid

src/index.js:5-7

is void element or not ? Means it will return true when val is undefined or null

Parameters

  • obj any

Returns boolean

isArray

src/index.js:11-13

to check whether a variable is array

Parameters

  • arr any

Returns boolean

isFunction

src/index.js:18-20

is it a function or not

Parameters

  • obj any

Returns boolean

isObject

src/index.js:25-28

is it an object or not

Parameters

  • obj any

Returns boolean

isNumber

src/index.js:32-34

to tell you if it's a real number

Parameters

  • obj any

Returns boolean

isNumeric

src/index.js:38-40

to tell you if the val can be transfer into number

Parameters

  • obj any

Returns boolean

isInteger

src/index.js:44-46

is it an interget or not

Parameters

  • num any

Returns boolean

isEmpty

src/index.js:51-59

return true when the value is "", {}, [], 0, null, undefined, false.

Parameters

  • obj any

Returns boolean

isEvent

src/index.js:63-65

is it an event or not

Parameters

  • obj any

Returns boolean

isBlob

src/index.js:69-71

is it a blob

Parameters

  • obj any

Returns boolean

isFile

src/index.js:75-77

is it a file uploaded by user through file inpue

Parameters

  • obj any

Returns boolean

isDate

src/index.js:81-83

is it a date

Parameters

  • obj any

Returns boolean

isString

src/index.js:87-90

is it a string

Parameters

  • str any

Returns boolean

isBoolean

src/index.js:94-96

is Boolean or not

Parameters

  • bool any

Returns boolean

isPromise

src/index.js:100-102

is a promise or not

Parameters

  • obj any

Returns boolean

isPrimitive

src/index.js:106-108

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

src/index.js:112-114

is it an url, but this test require the url to have an protocol

Parameters

  • str any

Returns boolean

isNode

src/index.js:118-125

to test if a HTML node

Parameters

  • obj any

Returns boolean

isElement

src/index.js:129-137

to test if a HTML element

Parameters

  • obj any

Returns boolean

isChildNode

src/index.js:141-146

check if node A is node B's parent or not

Parameters

Returns boolean

isPosterityNode

src/index.js:150-161

check if node B is node A's posterrity or not

Parameters

Returns boolean

isHTMLString

src/index.js:165-167

check if the string is an HTMLString

Parameters

Returns boolean

isError

src/index.js:171-173

check if is an error

Parameters

  • val any

Returns boolean