Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonschlinkert/uniqueid
Generate a unique sequential ID. Optionally pass a prefix, suffix, or multiplier.
https://github.com/jonschlinkert/uniqueid
Last synced: about 1 month ago
JSON representation
Generate a unique sequential ID. Optionally pass a prefix, suffix, or multiplier.
- Host: GitHub
- URL: https://github.com/jonschlinkert/uniqueid
- Owner: jonschlinkert
- License: mit
- Created: 2014-09-14T08:14:42.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-12-12T07:36:19.000Z (about 1 year ago)
- Last Synced: 2024-10-30T05:31:56.196Z (about 2 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 17
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# `uniqueid`
[![NPM version][npm-image]][npm-url]
[![NPM downloads][downloads-image]][downloads-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]> Generate sequential IDs, with optional prefix or suffix.
## Installation
```bash
npm i uniqueid --save-dev
```## Usage
```js
var uniqueid = require('uniqueid')
var first = uniqueid('prefix')
var second = uniqueid(null, 'suffix')console.log(first()) //=> "prefix0"
console.log(second()) //=> "0suffix"
console.log(first()) //=> "prefix1"
console.log(second()) //=> "1suffix"
```* **prefix** Set the prefix for id generation (string, default: `''`)
* **suffix** Set the suffix for id generation (string, default: `''`)## Typings
Includes a [TypeScript definition](index.d.ts).
## Contributing
```bash
npm install
npm test
```## License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
[npm-image]: https://img.shields.io/npm/v/uniqueid.svg?style=flat
[npm-url]: https://npmjs.org/package/uniqueid
[downloads-image]: https://img.shields.io/npm/dm/uniqueid.svg?style=flat
[downloads-url]: https://npmjs.org/package/uniqueid
[travis-image]: https://img.shields.io/travis/jonschlinkert/uniqueid.svg?style=flat
[travis-url]: https://travis-ci.org/jonschlinkert/uniqueid
[coveralls-image]: https://img.shields.io/coveralls/jonschlinkert/uniqueid.svg?style=flat
[coveralls-url]: https://coveralls.io/r/jonschlinkert/uniqueid?branch=master