1.0.18 • Published 4 years ago

typeis.js v1.0.18

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

TypeIs.js

The fast and reliable JS type-checking toolbox!

npm npm Twitter Follow

Installation

Using npm

npm i typeis.js

Usage

In Node (CommonJS)

const {
  isArray,
  isArrayLike,
  isBoolean,
  isFunction,
  isNull,
  isNumber,
  isObject,
  isObjectLike,
  isPlainObject,
  isString,
  isSymbol,
  isUndefined,
  isArguments,
} = require("typeis.js");

// on "undefined" -> false
console.log(isPlainObject());

// on "null" -> false
console.log(isPlainObject(null));

// on "number" -> false
console.log(isPlainObject(100));

// on "string" -> false
console.log(isPlainObject("foo"));

// on "boolean" -> false
console.log(isPlainObject(true));

// on "plain object" -> true
console.log(isPlainObject({ a: 100, b: 200 }));

// on "array" -> false
console.log(isPlainObject([1, 2, 3]));

// on "function" -> false
console.log(
  isPlainObject(function () {
    return "bar";
  })
);

In the Browser (ES6 modules):

import { isArray, isArrayLike } from "typeis.js";

...Or include the distributed minified file in the script tag:

<script src="./path/to/typeis.min.js"></script>
<script>
  console.log(typeis.isNumber(100));
</script>

Contributing

If you find any issues, feel free to submit a pull request

Author

iClusterDev

License

This project is under the MIT License

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago