Aller au contenu principal

@w5s/num

W5S Number, BigInt, Int modules (@w5s/num)

NPM Version License

Installation

npm install @w5s/num

Usage

import { Option } from '@w5s/core';
import { BigInt } from '@w5s/num';

export function main() {
const expressions = ['1n', '2n', 'foo'];
for (const expression of expressions) {
const valueOption = BigInt.parse(expression);
if (Option.isSome(valueOption)) {
console.log(BigInt['!='](valueOption, 1n));
} else {
console.error('Failed to parse the expression');
}
}
// Will output
// > true
// > false
// !> Failed to parse the expression
}

License

MIT © Julien Polo julien.polo@gmail.com

Index

Namespaces

Type Aliases

Variables

Type Aliases

Int

Int: IntType

Integer value

Alias of @w5s/core!Type.Int

RoundingMode

RoundingMode: Enum.ValueOf<typeof RoundingMode>

Variables

constRoundingMode

RoundingMode: Enum<{ Ceil: ceil; Down: down; Floor: floor; HalfDown: half-down; HalfEven: half-even; HalfUp: half-up; Up: up; typeName: RoundingMode }> = ...
Page Options