# toxic-predicate-functions

> predicate functions

Latest version **0.4.2** (published 2019-10-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install toxic-predicate-functions
pnpm add toxic-predicate-functions
yarn add toxic-predicate-functions
bun add toxic-predicate-functions
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.2 |
| Published | 2019-10-02 |
| First published | 2017-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 53 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | toxic-johann |
| Maintainers | toxicjohann |
| Keywords | predicate, functions, utils |

## Links

- npm: https://www.npmjs.com/package/toxic-predicate-functions
- Repository: https://github.com/toxic-johann/toxic-predicate-functions
- Homepage: https://github.com/toxic-johann/toxic-predicate-functions#readme
- Issues: https://github.com/toxic-johann/toxic-predicate-functions/issues
- npm.io page: https://npm.io/package/toxic-predicate-functions

## Dependencies (2)

- [lodash-es](https://npm.io/package/lodash-es.md) ^4.17.15
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.6.2

## Recent versions

- 0.4.2 (latest) — 2019-10-02
- 0.4.3-0 (beta) — 2019-10-02
- 0.4.1 — 2019-06-03
- 0.4.0 — 2019-06-02
- 0.3.2 — 2019-06-01
- 0.3.1 — 2019-06-01
- 0.3.0 — 2019-06-01
- 0.2.5 — 2019-04-25
- 0.2.4 — 2018-12-12
- 0.2.3 — 2018-10-07
- 0.2.2 — 2018-09-20
- 0.2.1 — 2018-09-16
- 0.2.0 — 2018-08-27
- 0.2.0-alpha.2 — 2018-08-26
- 0.2.0-alpha.1 — 2018-08-26
- … 6 more at https://npm.io/package/toxic-predicate-functions/versions

## README

# toxic-predicate-functions

[![Build Status](https://img.shields.io/travis/toxic-johann/toxic-predicate-functions/master.svg?style=flat-square)](https://travis-ci.org/toxic-johann/toxic-predicate-functions.svg?branch=master)
[![Coverage Status](https://img.shields.io/coveralls/toxic-johann/toxic-predicate-functions/master.svg?style=flat-square)](https://coveralls.io/github/toxic-johann/toxic-predicate-functions?branch=master)
[![npm](https://img.shields.io/npm/v/toxic-predicate-functions.svg?colorB=brightgreen&style=flat-square)](https://www.npmjs.com/package/toxic-predicate-functions)
[![dependency Status](https://david-dm.org/toxic-johann/toxic-predicate-functions.svg)](https://david-dm.org/toxic-johann/toxic-predicate-functions)
[![devDependency Status](https://david-dm.org/toxic-johann/toxic-predicate-functions/dev-status.svg)](https://david-dm.org/toxic-johann/toxic-predicate-functions?type=dev) [![Greenkeeper badge](https://badges.greenkeeper.io/toxic-johann/toxic-predicate-functions.svg)](https://greenkeeper.io/)

predicate functions collection

## get started

```shell
npm install toxic-predicate-functions --save
```

if you are using `flow`, you should import our flow defination, by adding this to your `.flowconfig`.

```ya
[ignore]

[include]

[libs]
./node_modules/toxic-predicate-functions/lib/index.flow.js
[options]

[lints]
```

## doc

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### defined

[src/index.js:5-7](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L5-L7 "Source code on GitHub")

to check whether the object is defined or not

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isVoid

[src/index.js:11-13](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L11-L13 "Source code on GitHub")

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

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isArray

[src/index.js:17-19](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L17-L19 "Source code on GitHub")

to check whether a variable is array

**Parameters**

-   `arr` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isFunction

[src/index.js:24-26](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L24-L26 "Source code on GitHub")

is it a function or not

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isObject

[src/index.js:31-34](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L31-L34 "Source code on GitHub")

is it an object or not

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isNumber

[src/index.js:38-40](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L38-L40 "Source code on GitHub")

to tell you if it's a real number

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isNumeric

[src/index.js:44-46](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L44-L46 "Source code on GitHub")

to tell you if the val can be transfer into number

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isInteger

[src/index.js:50-52](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L50-L52 "Source code on GitHub")

is it an interget or not

**Parameters**

-   `num` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isEmpty

[src/index.js:57-65](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L57-L65 "Source code on GitHub")

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

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isEvent

[src/index.js:69-71](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L69-L71 "Source code on GitHub")

is it an event or not

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isBlob

[src/index.js:75-77](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L75-L77 "Source code on GitHub")

is it a blob

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isFile

[src/index.js:81-83](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L81-L83 "Source code on GitHub")

is it a file uploaded by user through file inpue

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isDate

[src/index.js:87-89](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L87-L89 "Source code on GitHub")

is it a date

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isString

[src/index.js:93-96](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L93-L96 "Source code on GitHub")

is it a string

**Parameters**

-   `str` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isBoolean

[src/index.js:100-102](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L100-L102 "Source code on GitHub")

is Boolean or not

**Parameters**

-   `bool` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isPromise

[src/index.js:106-108](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L106-L108 "Source code on GitHub")

is a promise or not

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isPrimitive

[src/index.js:112-114](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L112-L114 "Source code on GitHub")

is Primitive type or not, whick means it will return true when data is number/string/boolean/undefined/null

**Parameters**

-   `val` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isUrl

[src/index.js:118-120](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L118-L120 "Source code on GitHub")

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

**Parameters**

-   `str` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isNode

[src/index.js:124-131](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L124-L131 "Source code on GitHub")

to test if a HTML node

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isElement

[src/index.js:135-143](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L135-L143 "Source code on GitHub")

to test if a HTML element

**Parameters**

-   `obj` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isChildNode

[src/index.js:147-152](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L147-L152 "Source code on GitHub")

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

**Parameters**

-   `parent` **[Node](https://developer.mozilla.org/en-US/docs/Web/API/Node/nextSibling)** 
-   `child` **[Node](https://developer.mozilla.org/en-US/docs/Web/API/Node/nextSibling)** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isPosterityNode

[src/index.js:156-167](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L156-L167 "Source code on GitHub")

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

**Parameters**

-   `parent` **[Node](https://developer.mozilla.org/en-US/docs/Web/API/Node/nextSibling)** 
-   `child` **[Node](https://developer.mozilla.org/en-US/docs/Web/API/Node/nextSibling)** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isHTMLString

[src/index.js:171-173](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L171-L173 "Source code on GitHub")

check if the string is an HTMLString

**Parameters**

-   `str` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isError

[src/index.js:177-179](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L177-L179 "Source code on GitHub")

check if is an error

**Parameters**

-   `val` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** 

### isRegExp

[src/index.js:183-185](https://github.com/toxic-johann/toxic-predicate-functions/blob/126adb1bdf2ab98826e10aa1b465209accb97197/src/index.js#L183-L185 "Source code on GitHub")

check if is an RegExp

**Parameters**

-   `val` **any** 

Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**

---
_Source: https://npm.io/package/toxic-predicate-functions · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
