UNPKG

locutus

Version:

Locutus other languages' standard libraries to JavaScript for fun and educational purposes

17 lines (16 loc) 556 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._php_cast_float = _php_cast_float; const _php_cast_int_ts_1 = require("./_php_cast_int.js"); function _php_cast_float(value) { // original by: Rafał Kukawski if (typeof value === 'number') { return value; } if (typeof value === 'string') { return parseFloat(value) || 0; } // PHP docs state, that for types other than string // conversion is {input type}->int->float return (0, _php_cast_int_ts_1._php_cast_int)(value); }