https://github.com/guseyn/cutie-is
Cutie extension for checking types in JavaScript.
https://github.com/guseyn/cutie-is
Last synced: 10 months ago
JSON representation
Cutie extension for checking types in JavaScript.
- Host: GitHub
- URL: https://github.com/guseyn/cutie-is
- Owner: Guseyn
- License: mit
- Created: 2018-05-21T12:23:11.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-02-11T16:00:05.000Z (over 4 years ago)
- Last Synced: 2025-08-20T14:52:39.839Z (11 months ago)
- Language: JavaScript
- Size: 101 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cutie-is
[](https://npmjs.org/package/@cuties/is)
[](https://travis-ci.org/Guseyn/cutie-is)
[](https://codecov.io/gh/Guseyn/cutie-is)
[Cutie](https://github.com/Guseyn/cutie) extension for checking types in JavaScript. It's based on the [Async Tree Pattern](https://github.com/Guseyn/async-tree-patern/blob/master/Async_Tree_Patern.pdf).
## Examples
You can find examples of using this library in the [test directory](https://github.com/Guseyn/cutie-is/tree/master/test).
## Install
`npm install @cuties/is`
## Run test
`npm test`
## Run build
`npm run build`
## Usage
```js
const {
// Here needed async objects from the table below
} = require('@cuties/is');
```
| Async Object | Async/sync call | Parameters | Representation result |
| ------------- | ----------------| ---------- | --------------------- |
| `Is` | `value instanceof clazz` | `value, clazz` | `boolean` |
| `IsArray` | `Array.isArray` | `value` | `boolean` |
| `IsBoolean` | `typeof value === 'boolean'` | `value` | `boolean` |
| `IsDate` | `value instanceof Date` | `value` | `boolean` |
| `IsFunction` | `typeof value === 'function'` | `value` | `boolean` |
| `IsNull` | `typeof value === null` | `value` | `boolean` |
| `IsNumber` | `typeof value === 'number'` | `value` | `boolean` |
| `IsObject` | `typeof value === 'object'` | `value` | `boolean` |
| `IsRealObject` | `typeof value === 'object' && value !== null` | `value` | `boolean` |
| `IsString` | `typeof value === 'string'` | `value` | `boolean` |
| `IsSymbol` | `typeof value === 'symbol'` | `value` | `boolean` |
| `IsUndefined` | `typeof value === 'undefined'` | `value` | `boolean` |