# nn-validate

> Validation functions.

Latest version **1.2.5** (published 2022-03-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install nn-validate
pnpm add nn-validate
yarn add nn-validate
bun add nn-validate
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.5 |
| Published | 2022-03-25 |
| First published | 2021-09-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Nneba13 |
| Maintainers | nneba13 |

## Links

- npm: https://www.npmjs.com/package/nn-validate
- npm.io page: https://npm.io/package/nn-validate

## Recent versions

- 1.2.5 (latest) — 2022-03-25
- 1.2.4 — 2022-02-17
- 1.2.3 — 2022-01-29
- 1.2.2 — 2022-01-01
- 1.2.1 — 2021-10-21
- 1.2.0 — 2021-10-17
- 1.1.0 — 2021-10-16
- 1.0.1 — 2021-09-18
- 1.0.0 — 2021-09-18
- 0.0.0 — 2021-09-18

## README

# `nn-validate`

> Common validation functions.

## Usage

```
import { getType } from 'nn-validate';
import { isDef } from 'nn-validate';
import { isVoid } from 'nn-validate';
import { isUndefined } from 'nn-validate';
import { isNull } from 'nn-validate';
import { isBoolean } from 'nn-validate';
import { isInteger } from 'nn-validate';
import { isNumber } from 'nn-validate';
import { isInfinity } from 'nn-validate';
import { isString } from 'nn-validate';
import { isPrimitive } from 'nn-validate';
import { isArray } from 'nn-validate';
import { isObject } from 'nn-validate';
import { isObjectExArray } from 'nn-validate';
import { isDate } from 'nn-validate';
import { isDateValid } from 'nn-validate';
import { isFunction } from 'nn-validate';
import { isSymbol } from 'nn-validate';
import { isEmpty } from 'nn-validate';
import { isArrayEmpty } from 'nn-validate';
import { isObjectEmpty } from 'nn-validate';
import { isPrimitive } from 'nn-validate';
import { isPromiseLike } from 'nn-validate';

const value = 'Some value';

// Get value type.
getType( value ) // Returns "[object String]"

// Checks if value is not undefined or null.
isDef( value ) // Returns true

// Checks if value is undefined or null.
isVoid( value ) // Returns false, same as !isDef( value )

// Checks if value is undefined.
isUndefined( value ) // Returns false

// Checks if value is null.
isNull( value ) // Returns false

// Checks if value is a boolean.
isBoolean( value ) // Returns false

// Checks if value is an integer.
isInteger( value ) // Returns false

// Checks if value is an number.
isNumber( value ) // Returns false

// Checks if value is infinity or -infinity.
isInfinity( value ) // Returns false

// Checks if value is a string.
isString( value ) // Returns true

// Checks if value is an array.
isArray( value ) // Returns false

// Checks if value is an object.
isObject( value ) // Returns false

// Checks if value is an object but not an array.
isObjectExArray( [] ) // Returns false
isObjectExArray( {} ) // Returns true

// Checks if value is date.
isDate( 0 ) // Returns false
isDate( new Date( 1970, 0, 1, 0, 0, 0, 0 ) ) // Returns true

// Checks if value is valid date.
isDateValid( new Date( 'Abc' ) ) // Returns false
isDateValid( new Date( 1970, 0, 1, 0, 0, 0, 0 ) ) // Returns true

// Checks if value is function.
isFunction( value ) // Returns false

// Checks if value is a symbol.
isSymbol( Symbol() ) // Returns true

// Checks if value is empty. A value is considered empty if it is: undefined, null, empty string,
// empty array, object without any keys (e.g. {}).
isEmpty( value ) // Returns false

// Checks if value is an empty array.
isArrayEmpty( value ) // Returns false

// Checks if value is an empty object (i.e. object without any keys).
isObjectEmpty( value ) // Returns false

// Checks if value is undefined, null, boolean, number, infinity, string, or symbol.
isPrimitive( value ) // Returns true

// Checks if value is like a promise (i.e. must have 'then' and 'catch' functions).
isPromiseLike( new Promise( ( resolve, reject ) => resolve() ) ) // Returns true
```

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