New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@primitive/is-number

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@primitive/is-number

Determine if a value is a number

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
2
Created
Source

is-number

NPM NPM LICENSE

Determine if a value is a number.

A value is a number if it is of primitive type number, or is an instance of reference type Number.

Usage

    npm install @primitive/is-number --save   # Install package via NPM
    yarn add @primitive/is-number             # Install package via Yarn
    import { expect } from "chai";
    import isNumber from "@primitive/is-number";

    expect(isNumber(42)).to.be.true;
    expect(isNumber(0))to.be.true;
    expect(isNumber(new Number(1000))).to.be.true;

    expect(isNumber(undefined)).to.be.false;
    expect(isNumber(null)).to.be.false;
    expect(isNumber("42").to.be.false;

This package contains TypeScript type declarations. Furthermore, the package uses TypeScript type guards to allow type inference to influence intellisense.

    if (isNumber(x)) {
        // IntelliSense now knows `x` is a number.
        let y: number = x;
    }

Build & Test

This package uses Gulp for building, and Chai and Mocha for testing.

    npm install     # Installs dependencies.
    npm run build   # Build the project.
    npm test        # Run tests.

License

Refer to the LICENSE file for license information.

Keywords

assert

FAQs

Package last updated on 23 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts