toxic-predicate-functions
TypeScript icon, indicating that this package has built-in type declarations

0.4.2 • Public • Published

toxic-predicate-functions

Build Status Coverage Status npm dependency Status devDependency Status Greenkeeper badge

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

  • obj any

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

  • obj any

Returns boolean

isArray

src/index.js:17-19

to check whether a variable is array

Parameters

  • arr any

Returns boolean

isFunction

src/index.js:24-26

is it a function or not

Parameters

  • obj any

Returns boolean

isObject

src/index.js:31-34

is it an object or not

Parameters

  • obj any

Returns boolean

isNumber

src/index.js:38-40

to tell you if it's a real number

Parameters

  • obj any

Returns boolean

isNumeric

src/index.js:44-46

to tell you if the val can be transfer into number

Parameters

  • obj any

Returns boolean

isInteger

src/index.js:50-52

is it an interget or not

Parameters

  • num any

Returns boolean

isEmpty

src/index.js:57-65

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

Parameters

  • obj any

Returns boolean

isEvent

src/index.js:69-71

is it an event or not

Parameters

  • obj any

Returns boolean

isBlob

src/index.js:75-77

is it a blob

Parameters

  • obj any

Returns boolean

isFile

src/index.js:81-83

is it a file uploaded by user through file inpue

Parameters

  • obj any

Returns boolean

isDate

src/index.js:87-89

is it a date

Parameters

  • obj any

Returns boolean

isString

src/index.js:93-96

is it a string

Parameters

  • str any

Returns boolean

isBoolean

src/index.js:100-102

is Boolean or not

Parameters

  • bool any

Returns boolean

isPromise

src/index.js:106-108

is a promise or not

Parameters

  • obj any

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

  • val any

Returns boolean

isUrl

src/index.js:118-120

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

Parameters

  • str any

Returns boolean

isNode

src/index.js:124-131

to test if a HTML node

Parameters

  • obj any

Returns boolean

isElement

src/index.js:135-143

to test if a HTML element

Parameters

  • obj any

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

  • val any

Returns boolean

isRegExp

src/index.js:183-185

check if is an RegExp

Parameters

  • val any

Returns boolean

Package Sidebar

Install

npm i toxic-predicate-functions

Weekly Downloads

131

Version

0.4.2

License

MIT

Unpacked Size

54.3 kB

Total Files

13

Last publish

Collaborators

  • toxicjohann