UNPKG

@tai-kun/surrealdb

Version:

The SurrealDB SDK for JavaScript

197 lines 5.76 kB
import { CBOR_TAG_DECIMAL, type Encodable } from "@tai-kun/surrealdb/encodable-datatypes"; export type DecimalRoundingMode = 0 | 1 | 2 | 3; export interface DecimalConstructor { /** * [API Reference](https://mikemcl.github.io/big.js/#big) */ new (source: string | number | Decimal): Decimal; /** * [API Reference](https://mikemcl.github.io/big.js/#big) */ (source: string | number | Decimal): Decimal; /** * [API Reference](https://mikemcl.github.io/big.js/#big) */ (source?: undefined): DecimalConstructor; /** * [API Reference](https://mikemcl.github.io/big.js/#dp) */ DP: number; /** * [API Reference](https://mikemcl.github.io/big.js/#rm) */ RM: number; /** * [API Reference](https://mikemcl.github.io/big.js/#eneg) */ NE: number; /** * [API Reference](https://mikemcl.github.io/big.js/#epos) */ PE: number; /** * [API Reference](https://mikemcl.github.io/big.js/#strict) */ strict: boolean; /** * [API Reference](https://mikemcl.github.io/big.js/#rm) */ readonly roundDown: 0; /** * [API Reference](https://mikemcl.github.io/big.js/#rm) */ readonly roundHalfUp: 1; /** * [API Reference](https://mikemcl.github.io/big.js/#rm) */ readonly roundHalfEven: 2; /** * [API Reference](https://mikemcl.github.io/big.js/#rm) */ readonly roundUp: 3; } interface Decimal extends Encodable { /** * [API Reference](https://mikemcl.github.io/big.js/#abs) */ abs(): this; /** * [API Reference](https://mikemcl.github.io/big.js/#add) */ add(n: string | number | Decimal): this; /** * [API Reference](https://mikemcl.github.io/big.js/#cmp) */ cmp(n: string | number | Decimal): -1 | 0 | 1; /** * [API Reference](https://mikemcl.github.io/big.js/#div) */ div(n: string | number | Decimal): this; /** * [API Reference](https://mikemcl.github.io/big.js/#eq) */ eq(n: string | number | Decimal): boolean; /** * [API Reference](https://mikemcl.github.io/big.js/#gt) */ gt(n: string | number | Decimal): boolean; /** * [API Reference](https://mikemcl.github.io/big.js/#gte) */ gte(n: string | number | Decimal): boolean; /** * [API Reference](https://mikemcl.github.io/big.js/#lt) */ lt(n: string | number | Decimal): boolean; /** * [API Reference](https://mikemcl.github.io/big.js/#lte) */ lte(n: string | number | Decimal): boolean; /** * [API Reference](https://mikemcl.github.io/big.js/#minus) */ minus(n: string | number | Decimal): this; /** * [API Reference](https://mikemcl.github.io/big.js/#mod) */ mod(n: string | number | Decimal): this; /** * [API Reference](https://mikemcl.github.io/big.js/#mul) */ mul(n: string | number | Decimal): this; /** * [API Reference](https://mikemcl.github.io/big.js/#neg) */ neg(): this; /** * [API Reference](https://mikemcl.github.io/big.js/#plus) */ plus(n: string | number | Decimal): this; /** * [API Reference](https://mikemcl.github.io/big.js/#pow) */ pow(exp: number): this; /** * [API Reference](https://mikemcl.github.io/big.js/#prec) */ prec(sd: number, rm?: DecimalRoundingMode): this; /** * [API Reference](https://mikemcl.github.io/big.js/#round) */ round(dp?: number, rm?: DecimalRoundingMode): this; /** * [API Reference](https://mikemcl.github.io/big.js/#sqrt) */ sqrt(): this; /** * [API Reference](https://mikemcl.github.io/big.js/#sub) */ sub(n: string | number | Decimal): this; /** * [API Reference](https://mikemcl.github.io/big.js/#times) */ times(n: string | number | Decimal): this; /** * [API Reference](https://mikemcl.github.io/big.js/#toExponential) */ toExponential(dp?: number, rm?: DecimalRoundingMode): string; /** * [API Reference](https://mikemcl.github.io/big.js/#toFixed) */ toFixed(dp?: number, rm?: DecimalRoundingMode): string; /** * [API Reference](https://mikemcl.github.io/big.js/#toPrecision) */ toPrecision(sd?: number, rm?: DecimalRoundingMode): string; /** * [API Reference](https://mikemcl.github.io/big.js/#toString) */ toString(): string; /** * [API Reference](https://mikemcl.github.io/big.js/#toNumber) */ toNumber(): number; /** * [API Reference](https://mikemcl.github.io/big.js/#valueOf) */ valueOf(): string; /** * [API Reference](https://mikemcl.github.io/big.js/#toJSON) */ toJSON(): string; /** * [API Reference](https://mikemcl.github.io/big.js/#coefficient) */ c: (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)[]; /** * [API Reference](https://mikemcl.github.io/big.js/#exponent) */ e: number; /** * [API Reference](https://mikemcl.github.io/big.js/#sign) */ s: -1 | 1; [Symbol.toPrimitive]: { (hint: "default" | "string"): string; (hint: "number"): number; (hint: string): string | number; }; toCBOR(): [ tag: typeof CBOR_TAG_DECIMAL, value: string ]; toPlainObject(): { value: string; singleDigits: (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)[]; /** Integer, -1e+6 ~ 1e+6 */ exponent: number; sign: -1 | 1; }; clone(): this; } /** * [API Reference](https://tai-kun.github.io/surrealdb.js/v2/api/data/decimal) */ declare const Decimal: DecimalConstructor; export default Decimal; //# sourceMappingURL=decimal.d.ts.map