x/numwizard@v1.2.1

A bunch of functions to convert numbers into strings of required format.
Latest
src/
import * as numwizard from "https://deno.land/x/numwizard@v1.2.1/mod.ts";

Functions

AddComma

Add commas to a number.

AddZero

Add zeros to the beginning of a number till it reaches a certain digit count.

InWords

Parse a number into an english word string.

Rearrange

Rearrange digits in a number or characters in a string randomly.

RemoveRecurring

Remove recurring digits in a number / characters in a string.

number-wizard

A bunch of functions to convert numbers into strings (or other numbers) of required format.

Some functions work with strings too because I am cool.

Modules

AddZero

Add zeroes to a number till they fill a specified digit count.

import { AddZero } from "https://deno.land/x/numwizard/mod.ts";

console.log(AddZero(1234, 9));
// "000001234"

AddComma

Add zeroes to a number till they fill a specified digit count.

import { AddComma } from "https://deno.land/x/numwizard/mod.ts";

console.log(AddComma(123456789)); // "123,456,789"
console.log(AddComma(123456789, "in")); // "12,34,56,789"

InWords

Get the given number in words. Kinda buggy rn.

import { InWords } from "https://deno.land/x/numwizard/mod.ts";

console.log(InWords(1214343484229417, true));
// twelve crore, fourteen lakh, thirty four thousand,
// three hundred and forty eight crore, forty two lakh,
// twenty nine thousand, four hundred and seventeen

Rearrange

Add zeroes to a number till they fill a specified digit count.

import { Rearrange } from "https://deno.land/x/numwizard/mod.ts";
console.log(Rearrange(324345));
// 324435

RemoveRecurring

Add zeroes to a number till they fill a specified digit count.

import { RemoveRecurring } from "https://deno.land/x/numwizard/mod.ts";

console.log(RemoveRecurring(453857349734756));
// 4538796