# jenis

> Data type checker utility

Latest version **0.0.2** (published 2019-02-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install jenis
pnpm add jenis
yarn add jenis
bun add jenis
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-02-08 |
| First published | 2019-02-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dwi Rizki Irawan |
| Maintainers | drizki |
| Keywords | data, type, type, type, checker, types, datatype, datatypes |

## Links

- npm: https://www.npmjs.com/package/jenis
- Repository: https://github.com/drizki/jenis
- Homepage: https://github.com/drizki/jenis#readme
- Issues: https://github.com/drizki/jenis/issues
- npm.io page: https://npm.io/package/jenis

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 0.0.2 (latest) — 2019-02-08
- 0.0.1 — 2019-02-08

## README

# Jenis
Jenis is a small js utility to check your data type.

## INSTALLATION
Add jenis to your project using npm or yarn:
``npm i jenis`` or ``yarn add jenis``

## API
There are two ways to check your data type using Jenis:

### Using ``jenis.is.[type]`` or ``jenis.not.[type]``
``.is`` and ``.not`` behaves the same way. It will compare your input to the rules then return boolean result.

**Example**

    const jenis = require('jenis')
    
    jenis.is.array(['apple', 'banana']) // true
    jenis.not.array(['apple','banana']) // false


| Type      | Param | Returns | Example                                                         |
|-----------|--------|---------|-----------------------------------------------------------------|
| string    | any    | boolean | ``jenis.is.string('Hello world')`` // true                               |
| array     | any    | boolean | ``jenis.is.array([])`` // true                                           |
| object    | any    | boolean | ``jenis.is.object({})`` // true                                          |
| number    | any    | boolean | ``jenis.is.number(1)`` // true                                           |
| function  | any    | boolean | ``jenis.is.function(function test(){})`` // true                         |
| null      | any    | boolean | ``jenis.is.null(null)`` // true                                          |
| undefined | any    | boolean | ``jenis.is.undefined()`` // true                                         |
| boolean   | any    | boolean | ``jenis.is.boolean(false)`` // true                                      |
| regexp    | any    | boolean | ``jenis.is.regexp(new RegExp)`` // true                                  |
| error     | any    | boolean | ``jenis.is.error(new Error)`` // true                                    |
| date      | any    | boolean | ``jenis.is.date(new Date)`` // true                                      |
| symbol    | any    | boolean | ``jenis.is.symbol(Symbol())`` // true                                    |
| promise   | any    | boolean | ``jenis.is.promise(new Promise(function (resolve, reject) {}))`` // true |



### Using ``.check()``
The ``check`` method will let you check what type of data supplied. This method return a string of data type, which can be one of the following:
- undefined
- string
- array
- object
- number
- function
- null
- boolean
- regexp
- error
- date
- symbol
- promise

**Example**
		
    const jenis = require('jenis')
    
    jenis.check('My string') // string

## TODO:
- Create test
- Add Travis CI

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