@silen/is-number
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

is-number

Determine if a value is Number

install

npm i @silen/is-number

api

  • declare function isNumber(val: any): boolean;

usage

const { isNumber } = require('@silen/is-number');
// or
import { isNumber } from '@silen/is-number';

console.log(isNumber(new Buffer(4)));
console.log(isNumber(Buffer.alloc(4)));
console.log(isNumber(undefined));
console.log(isNumber(null));
console.log(isNumber(''));
console.log(isNumber(true));
console.log(isNumber(0));
console.log(isNumber(1));
console.log(isNumber(1.0));
console.log(isNumber('string'));
console.log(isNumber({}));
console.log(isNumber(function foo() {}));
console.log(isNumber(Symbol()));
console.log(isNumber(new Set));
console.log(isNumber(new Map));
console.log(isNumber(new WeakMap));
console.log(isNumber(new WeakSet));

// or
console.log(window.Type.isNumber(new WeakSet));

This is a demo for testing the usage of isNumber from @silen/is-number module. You can try the others and do likewise.

others

Package Sidebar

Install

npm i @silen/is-number

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

7.92 kB

Total Files

9

Last publish

Collaborators

  • silentsun