number.issafeinteger
Version:
An ES-spec-compliant Number.isSafeInteger shim/polyfill/replacement that works as far down as ES3
25 lines (19 loc) • 868 B
JavaScript
import isSafeInteger, * as isSafeIntegerModule from 'number.issafeinteger';
import test from 'tape';
import runTests from './tests.js';
test('as a function', (t) => {
runTests(isSafeInteger, t);
t.end();
});
test('named exports', async (t) => {
t.deepEqual(
Object.keys(isSafeIntegerModule).sort(),
['default', 'shim', 'getPolyfill', 'implementation'].sort(),
'has expected named exports',
);
const { shim, getPolyfill, implementation } = isSafeIntegerModule;
t.equal((await import('number.issafeinteger/shim')).default, shim, 'shim named export matches deep export');
t.equal((await import('number.issafeinteger/implementation')).default, implementation, 'implementation named export matches deep export');
t.equal((await import('number.issafeinteger/polyfill')).default, getPolyfill, 'getPolyfill named export matches deep export');
t.end();
});