# errorsparty.dev-base

> Turn a number into various radiusses.

Latest version **1.1.0** (published 2020-07-18) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install errorsparty.dev-base
pnpm add errorsparty.dev-base
yarn add errorsparty.dev-base
bun add errorsparty.dev-base
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-07-18 |
| First published | 2020-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 24 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Errors Party |
| Maintainers | ihack2712 |

## Links

- npm: https://www.npmjs.com/package/errorsparty.dev-base
- Repository: https://ihacks.dev/errorsparty/base
- npm.io page: https://npm.io/package/errorsparty.dev-base

## Dependencies (1)

- [errorsparty.dev-bigint](https://npm.io/package/errorsparty.dev-bigint.md) ^1.1.2

## Recent versions

- 1.1.0 (latest) — 2020-07-18
- 1.0.3 — 2020-06-24
- 1.0.2 — 2020-06-23
- 1.0.1 — 2020-06-23
- 1.0.0 — 2020-06-23

## README

# errorsparty.dev-base

Turn a number into various radiusses.

## Installation

```shell
yarn add errorpary.dev-base
```

## Usage

In this Base module there are a few terms to learn;

- Alphabet - A set of characters used to define the number system.
- Base - In a positional numeral system, the radix or base is the number of unique digits, including the digit zero, used to represent numbers.
- Encode - To convert something to another system.
- Decode - To convert something from another system.

In this module an alphabet is a set of characters that build up the number system of the base. This module encodes from and decodes to Base 10, which is our normal number system. The module has Built-In alphabets and bases:

- Base2
- Base8
- Base10
- Base16
- Base32
- Base36
- Base62
- Base256

To use either of these bases you can import them by doing:

```typescript
// Imports
import { Base16 } from "errorsparty.dev-base";

// Encode some number
Base16.encode(123); // "7b"

// Decode some string
Base16.decode("7b"); // 123n
```

### Creating your own base.

myBase.ts
```typescript
// Imports
import {
	Alphabet,
	Base
} from "errorsparty.dev-base";

// My base's alphabet.
export const alphabet = new Alphabet("abcdef");

// My custom base.
export const base = new Base(alphabet);
```

## Gotchas

1. This module uses [errorsparty.dev-bigint](https://ihacks.dev/ErrorsParty/bigint) to turn input into a big integer, values like `123`, `"0b123"` or `"9".repeat(999)` are accepted.
2. Decoding returns a big integer, you can turn them into a number by using `Number(n)`.

---
_Source: https://npm.io/package/errorsparty.dev-base · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
