# Code coverage report for RxJS/dist/cjs/util/isNumeric.js

## Statements: 100% (6 / 6) Branches: 100% (2 / 2) Functions: 100% (1 / 1) Lines: 100% (6 / 6) Ignored: none

All files » RxJS/dist/cjs/util/ » isNumeric.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16

    1
    1
    1

    1

    39

    1"use strict";

    exports.__esModule = true;
    exports["default"] = isNumeric;
    var is_array = Array.isArray;

    function isNumeric(val) {
        // parseFloat NaNs numeric-cast false positives (null|true|false|"")
        // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
        // subtraction forces infinities to NaN
        // adding 1 corrects loss of precision from parseFloat (#15100)
        return !is_array(val) && val - parseFloat(val) + 1 >= 0;
    }

    ;
    module.exports = exports["default"];