@natoboram/based.ts
    Preparing search index...

    @natoboram/based.ts

    @natoboram/based.ts

    Node.js CI GitHub Pages GitHub Downloads NPM Downloads Dependabot Updates Wakapi

    A TypeScript library for working with arbitrary bases.

    It can be installed globally if you want to convert numbers or generate UUIDs from the terminal.

    pnpm install --global @natoboram/based.ts
    
    Usage: basedts convert [options] 
    
    Convert a number from a base in a space to another base in another space
    
    Arguments:
      number                The number to convert
    
    Options:
      --from-base     The base of the number (default: "10")
      --from-space   The space of the number to convert from (default: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/")
      --to-base       The base to convert to (default: "10")
      --to-space     The space to convert the number to (default: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/")
      -h, --help            Display help for command
    
    Usage: basedts uuid [options]
    
    Generate a UUID in a different base with a different space than normal UUIDs
    
    Options:
      --base     The base of the UUID to generate (default: "16")
      --space   The space of the UUID to generate (default: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/")
      -h, --help       Display help for command
    
    pnpm install @natoboram/based.ts
    
    import { toBase, basedToBigInt } from "@natoboram/based.ts"

    // Convert between two bases
    const bigInt = basedToBigInt("69", 10n)
    const based = toBase(bigInt, 16n)

    console.log(based) // 45
    import { Based } from "@natoboram/based.ts"

    // Perform operations on numbers of different bases
    const four = new Based("4", 64n)
    const two = new Based("2", 16n)
    const result = four.divide(two).to(10n)

    console.log(result.value) // 2