UNPKG

number.parsefloat

Version:

An ES-spec-compliant Number.parseFloat shim/polyfill/replacement that works as far down as ES3

25 lines (19 loc) 841 B
import parseFloat, * as parseFloatModule from 'number.parsefloat'; import test from 'tape'; import runTests from './tests.js'; test('as a function', (t) => { runTests(parseFloat, t); t.end(); }); test('named exports', async (t) => { t.deepEqual( Object.keys(parseFloatModule).sort(), ['default', 'shim', 'getPolyfill', 'implementation'].sort(), 'has expected named exports', ); const { shim, getPolyfill, implementation } = parseFloatModule; t.equal((await import('number.parsefloat/shim')).default, shim, 'shim named export matches deep export'); t.equal((await import('number.parsefloat/implementation')).default, implementation, 'implementation named export matches deep export'); t.equal((await import('number.parsefloat/polyfill')).default, getPolyfill, 'getPolyfill named export matches deep export'); t.end(); });