# auto-id-builder

> A simple id generation library for sequential series of alpha-numeric ids. The library allows generating IDs that are either all numeirc, alphabetical, alpha-numeric including a possiblity of mixing static and rolling parts. Example: 00A-001, AAA-001, STA

Latest version **1.0.0** (published 2019-07-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install auto-id-builder
pnpm add auto-id-builder
yarn add auto-id-builder
bun add auto-id-builder
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-07-20 |
| First published | 2019-07-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 22.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Puneet Maloo |
| Maintainers | pmaloo |
| Keywords | Alpha-numeric, ID, ID, static, id, multiple, part, id |

## Links

- npm: https://www.npmjs.com/package/auto-id-builder
- Repository: https://github.com/wittyPuneet/AutoIDBuilder
- Homepage: https://github.com/wittyPuneet/AutoIDBuilder#readme
- Issues: https://github.com/wittyPuneet/AutoIDBuilder/issues
- npm.io page: https://npm.io/package/auto-id-builder

## 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

- 1.0.0 (latest) — 2019-07-20

## README

## Welcome to AutoID

AutoID can generate multipart ids based on a given schema. The ids can be consist of multiple static and incrementing fragments with a combination of test and number. Example:
1. 001 -> 002
2. 0A-999 -> 0B-001
3. STATIC-0A-100 -> STATIC-0A-101
4. AZ-99-STATIC-ZZ-99 -> BA-01-STATIC-0A-01
_and more..._

**In a nutshell, the id is composed of static and dynamic fragments with no limit on how and where they are placed.**


### Usage


```markdown
const AutoID = require('AutoID');

//Define schema for 001
const idSchema = AutoID().newFormat()
    .addPart(false,'number',3)
    .compile();
console.log(idSchema.generateID()) //Prints 001
console.log(idSchema.generateID('001')) //Prints 002

const alphaNumericID = AutoID().newFormat()
    .addPart(false, 'string', 2)  //Add the dynamic string part.
    .addPart(true, '-', 1)        //Add the static string part.
    .addPart(false, 'number', 3)  //Add the dynamic numerical part.
    .compile();
console.log(alphaNumericID.generateID()) //Prints 0A-001
console.log(alphaNumericID.generateID('0A-999')) //Prints 0B-001

const complexID = AutoID().newFormat()
    .addPart(false,'string', 3)   //Add the dynamimc string part.
    .addPart(true,'-AutoID-')     //Add the static part
    .addPart(false, 'string', 2)  //Add the dynamic string part.
    .addPart(true, '-')           //Add the static string part.
    .addPart(false, 'number', 3)  //Add the dynamic numerical part.
    .compile();
console.log(complexID.generateID()) //Prints 00A-AutoID-0A-001# Header 1
```

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