number-detect

0.4.0 • Public • Published

NUMBER-DETECT

This library is a thin wrapper around the type-detect library, and began life as a rejected pull request for that library.

The library exposes a single function - numberDetect - which follows this logic:

  1. If the typeof the parameter passed is not equal to 'object' or 'number' return the typeof.
  2. If the typeof is 'object' and that object is null, return 'null', otherwise pass it to the type-detect library.
  3. If the typeof is 'number', sub-divide that type into 'NaN', 'Infinity', and 'number'.

The type-detect library only deals with 'object' typeofs and simply returns everything else, but for my uses, typeof 'number' is not useful given that typeof NaN, Infinity, and -Infinity all return 'number'. This library aims to fix that by returning a more meaningful result.

Installation

npm install --save number-detect

Codacy Badge

Readme

Keywords

Package Sidebar

Install

npm i number-detect

Weekly Downloads

0

Version

0.4.0

License

MIT

Unpacked Size

3.58 kB

Total Files

4

Last publish

Collaborators

  • xarxziux