# base-uuid

> UUID shortener

Latest version **0.1.8** (published 2019-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install base-uuid
pnpm add base-uuid
yarn add base-uuid
bun add base-uuid
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2019-03-23 |
| First published | 2018-02-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Tibor Szanto |
| Maintainers | teabore |
| Keywords | uuid, shortener |

## Links

- npm: https://www.npmjs.com/package/base-uuid
- Repository: https://github.com/teabore/base-uuid
- Issues: https://github.com/teabore/base-uuid/issues
- npm.io page: https://npm.io/package/base-uuid

## Dependencies (1)

- [base-x](https://npm.io/package/base-x.md) ^3.0.5

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.8 (latest) — 2019-03-23
- 0.1.7 — 2019-03-23
- 0.1.6 — 2018-02-27
- 0.1.5 — 2018-02-21
- 0.1.4 — 2018-02-21
- 0.1.3 — 2018-02-21
- 0.1.2 — 2018-02-21
- 0.1.1 — 2018-02-21
- 0.1.0 — 2018-02-20

## README

# base-uuid
[![GitHub license](https://img.shields.io/github/license/teabore/base-uuid.svg?style=flat-square)](https://github.com/teabore/base-uuid)
[![NPM Package](https://img.shields.io/npm/v/base-uuid.svg?style=flat-square)](https://www.npmjs.org/package/base-uuid)
[![Build Status](https://img.shields.io/travis/teabore/base-uuid.svg?branch=master&style=flat-square)](https://travis-ci.org/teabore/base-uuid)

Simple UUID shortener

## Installation

```shell
npm install base-uuid
```

## Usage
```js
const baseUuid = require('base-uuid');

const base62 = baseUuid(62); // Create a base62 encoder/decoder

// UUIDs
const uuid1 = '00000000-0000-4000-8000-000000000000';
const uuid2 = 'ffffffff-ffff-4fff-bfff-ffffffffffff';

// Shorten UUIDs
const encoded1 = base62.encode(uuid1); // 1vGeH72LxVtxKg
const encoded2 = base62.encode(uuid2); // 7N42dgm5pw9utfkXp3nwyH

// Decode shortened UUIDs
const decoded1 = base62.decode(encoded1); // 00000000-0000-4000-8000-000000000000
const decoded2 = base62.decode(encoded2); // ffffffff-ffff-4fff-bfff-ffffffffffff
```

## API
`const baseN = baseUuid([radix])`
Creates an encoder/decoder using `radix`. The default radix is 64.

`const str = baseN.encode(uuid)`
Creates a shortened UUID string.

`const uuid = baseN.decode(str)`
Decodes a shortened UUID.

`const uuid = baseN.decodePlain(str)`
Like `decode` but produces UUID without dashes.

`baseN.base`
Radix of the shortener, integer between 16...64.

## Credit

Based on [uuid-base62](https://github.com/dmarcelino/uuid-base62)

## License
[MIT](LICENSE)

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