JSPM

wirecheck

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q16883F
  • License MIT

A JavaScript/Typescript library for fast type checking. Check if a given value is a string, number, object, ...

Package Exports

  • wirecheck
  • wirecheck/lib/wirecheck.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wirecheck) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Bootstrap logo

WireCheck

Fast and easy JavaScript type checking for Strings, Numbers, Objects and Arrays.

Install

Install with npm:

$ npm install --save wirecheck

Usage

isString

import { isString } from 'wirecheck';

// True
isString('');
isString('hello');
isString(`number ${1}`);
isString([1, 2, 3].join('-'));

// False
isString(1);
isString(null);
isString(undefined);
isString(true);

isNumber

import { isNumber } from 'wirecheck';

// True
isNumber(1);
isNumber(1.1);
isNumber(0x88ffff);
isNumber('-10');

// False
isNumber(true);
isNumber(Infinity);
isNumber('hello');
isNumber([1, 2, 4]);

isObject

import { isObject } from 'wirecheck';

// True
isObject({});
isObject({ hello: 'world' });
isObject('{"array":[1,2,3]}');
isObject('{"nested":{"nestedChild":{"hello":"world"}}}');

// False
isObject(1);
isObject(null);
isObject('{"hello":"world"}}');
isObject([1, 2, 4]);

isArray

import { isArray } from 'wirecheck';

// True
isArray([]);
isArray([1, 2, 3]);
isArray([undefined, null, undefined]);
isArray([[[[[]], [[]]], [[[], [[[[[[], [[[]]]]]]]]]]]]);

// False
isArray(1);
isArray(null);
isArray({ hello: 'world' });
isArray('[[]');

Contributing

Issues, Pull Requests and Stars are welcome. For feature requests or bugs please open a new issue

License

Copyright © 2022, WireCore. Released under the MIT License.