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:
- If the typeof the parameter passed is not equal to 'object' or 'number' return the typeof.
- If the typeof is 'object' and that object is null, return 'null', otherwise pass it to the type-detect library.
- 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.
npm install --save number-detect