How to use the jsbi.greaterThan function in jsbi

To help you get started, we’ve selected a few jsbi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amzn / ion-js / src / JsbiSerde.ts View on Github external
static getUnsignedIntSizeInBytes(value: JSBI): number {
        // TODO: Profile on real data sets to see if binary search is preferable to a low-to-high linear search.
        for (let m = 0; m < this.SIZE_THRESHOLDS.length; m++) {
            let threshold = this.SIZE_THRESHOLDS[m];
            if (JSBI.lessThanOrEqual(value, threshold)) {
                return m + 1;
            }
        }

        let sizeInBytes = this.SIZE_THRESHOLDS.length;
        let threshold: JSBI = this.calculateSizeThreshold(sizeInBytes);
        while (JSBI.greaterThan(value, threshold)) {
            // TODO: Make larger jumps, then refine the search.
            sizeInBytes++;
            threshold = this.calculateSizeThreshold(sizeInBytes);
        }

        return sizeInBytes;
    }
github GoogleChromeLabs / babel-plugin-transform-jsbi-to-bigint / test / fixtures / short-import-specifier / input.js View on Github external
JSBI.divide(a, b);
JSBI.remainder(a, b);
JSBI.exponentiate(a, b);
const c = JSBI.unaryMinus(a);
const d = JSBI.bitwiseNot(a);
JSBI.leftShift(a, b);
JSBI.signedRightShift(a, b);
JSBI.bitwiseAnd(a, b);
JSBI.bitwiseOr(a, b);
JSBI.bitwiseXor(a, b);

JSBI.equal(a, b);
JSBI.notEqual(a, b);
JSBI.lessThan(a, b);
JSBI.lessThanOrEqual(a, b);
JSBI.greaterThan(a, b);
JSBI.greaterThanOrEqual(a, b);

JSBI.EQ(a, b);
JSBI.NE(a, b);
JSBI.LT(a, b);
JSBI.LE(a, b);
JSBI.GT(a, b);
JSBI.GE(a, b);

a.toString();
JSBI.toNumber(a);
a instanceof JSBI;

JSBI.asIntN(64, JSBI.BigInt('42'));
JSBI.asUintN(64, JSBI.BigInt('42'));
github amzn / ion-js / src / JsbiSupport.ts View on Github external
public static clampToSafeIntegerRange(value: JSBI): number {
        if (JSBI.greaterThan(value, this.NUMBER_MAX_SAFE_INTEGER)) {
            return Number.MAX_SAFE_INTEGER;
        }
        if (JSBI.lessThan(value, this.NUMBER_MIN_SAFE_INTEGER)) {
            return Number.MIN_SAFE_INTEGER;
        }
        return JSBI.toNumber(value);
    }

jsbi

JSBI is a pure-JavaScript implementation of [the ECMAScript BigInt proposal](https://tc39.es/proposal-bigint/), which officially became a part of the JavaScript language in ES2020.

Apache-2.0
Latest version published 3 years ago

Package Health Score

77 / 100
Full package analysis

Similar packages