dist/utilify.esm.js
function toNumber(value) {
        var _this = this;

        if (validateHelpers.isArray(value)) {
            return value.map(function (a) {
                return _this.toNumber(a);
            });
        }

        var number = parseFloat(value);

        if (number === undefined) {
            return value;
        }

        if (number.toString().length !== value.toString().length && !validateHelpers.isNumeric(value)) {
            return value;
        }

        return validateHelpers.isNumber(number) ? value : number;
    }
function toNumber(value) {
        var _this = this;

        if (validateHelpers.isArray(value)) {
            return value.map(function (a) {
                return _this.toNumber(a);
            });
        }

        var number = parseFloat(value);

        if (number === undefined) {
            return value;
        }

        if (number.toString().length !== value.toString().length && !validateHelpers.isNumeric(value)) {
            return value;
        }

        return validateHelpers.isNumber(number) ? value : number;
    }
function toNumber ( value ) { var _this = this ; if ( validateHelpers . isArray ( value ) ) { return value . map ( function ( a ) { return _this . toNumber ( a ) ; } ) ; } var number = parseFloat ( value ) ; if ( number === undefined ) { return value ; } if ( number . toString ( ) . length !== value . toString ( ) . length && ! validateHelpers . isNumeric ( value ) ) { return value ; } return validateHelpers . isNumber ( number ) ? value : number ; }
Converts a value to a number if possible.

@category Global
@param {Mix} value The value to convert.
@returns {Number} The converted number, otherwise the original value.
@example
toNumber('123') // 123
toNumber('123.456') // 123.456
Converts a value to a number if possible .