Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/typical/strnum.ts

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
import * as rimbu from "https://deno.land/x/rimbu@0.13.1/typical/strnum.ts";

Type Aliases

Returns the result of adding the two given string-numbers.

Given two string digits, this type returns a tuple of which the first element is the digit resulting from addition of the two digits, and the second element is a boolean indicating whether there was an overflow.

Builds a tuple of the length of a given string-number. The length can be used to convert a string-number to a number.

All numeric digits as strings

A table from StringDigits to an array that repeats the elements of given array T digit amount of times. 'deca' is used to represent an exponent of 10

Converts a natural number to a string-number, otherwise never.

Type that validates whether a given string-number is even. Checks that the last digit is even.

Returns true if the given string is a valid natural number, false otherwise.

Type that validates whether a given string-number is odd. Checks that the last digit is odd.

Returns true if the given string is a valid positive integer, false otherwise.

Returns the result of multiplying the given string number with the given digit.

Type that will return the incoming type if the value is a valid natural number, or never otherwise.

Positive numeric digits as strings

Type that will return the incoming type if the value is a valid positive integer, or never otherwise.

Given two string digits, returns a tuple of which the first element is the resulting digit from subtracting the second from the first, and the second element a boolean that is true if there is an 'underflow' or borrow, never otherwise.

Returns the result of subtracting the second from the first given string-number, or never if the second value is greater than the first. (Only natural numbers currently supported)

A symmetric tuple, where the order or the elements does not matter. As an example: SymTup<'a', 1> is equal to SymTup<1, 'a'>

Converts the given string-number to its corresponding number.

Infers and returns the length of given Tuple T.