0.2.2 • Published 2 years ago

jsbi-compat v0.2.2

Weekly downloads
1
License
MIT
Repository
github
Last release
2 years ago

jsbi-compat

Provides a jsbi interface on top of native BigInt and provides a fallback to jsbi library when BigInt is not available. Adds isBigInt function for cross-implementation type checking.

See jsbi for API details.

var JSBI = require('jsbi-compat');

const max = JSBI.BigInt(Number.MAX_SAFE_INTEGER);
console.log(String(max));
// → '9007199254740991'
const other = JSBI.BigInt('2');
const result = JSBI.add(max, other);
console.log(String(result));
// → '9007199254740993'

// compat extended API
console.log(JSBI.isBigInt(JSBI.BigInt('2')));
// → true