Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @codevor/js-is-type with all npm packages installed. Try it out:

var jsIsType = require("@codevor/js-is-type")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@codevor/js-is-type v0.2.0

🎯Type-checking for 'Primitive' JS Types made easy!

🎯Type-checking for 'Primitive' JS Types

License Travis CI Coverage Status Commitizen

Type-check for 'Primitive' types in JavaScript are always something to take care when receiving/sending a payload from/to Server/Client application. If you ever wonder how to do this you can sure use typeof and make the check by yourself. Or you can user 🎯js-is-type!

The usage is simple and verbose. The tests has full coverage and you can use without a doubt.

Available Types

  • isArray()
  • isBoolean()
  • isFunction()
  • isObject() (_Remember: in JS, Arrays are Objects!_)
  • isString()
  • isUndefined()

Installation

js-is-type is available on npm/yarn:

$ npm install @codevor/js-is-type --save
$ yarn add @codevor/js-is-type

Usage

With ES6/import

import { isArray } from '@codevor/js-is-type';

const names = ['Alice', 'Bob'];

isArray(names); // => true

With require

const isArray = require('@codevor/js-is-type').isArray;

const names = ['Alice', 'Bob'];

isArray(names); // => true

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Changelog

This project adheres to Semantic Versioning. Every release, along with the migration instructions, is documented on the Github Releases page.

Bugs and Sugestions

Report bugs or do suggestions using the issues.

License

MIT License © Codevor

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free