Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hustcc/short-unique-string
:ab: Generate short unique id string locally, used optimize javascript code.
https://github.com/hustcc/short-unique-string
short-id short-unique-string uniqueid
Last synced: about 2 months ago
JSON representation
:ab: Generate short unique id string locally, used optimize javascript code.
- Host: GitHub
- URL: https://github.com/hustcc/short-unique-string
- Owner: hustcc
- Created: 2018-09-28T12:57:13.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-29T01:53:09.000Z (about 6 years ago)
- Last Synced: 2024-10-17T16:04:25.351Z (2 months ago)
- Topics: short-id, short-unique-string, uniqueid
- Language: JavaScript
- Homepage: https://github.com/hustcc/short-unique-string
- Size: 1.95 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# short-unique-string
> Generate short unique id string locally. Generate `7921` unique id string with only length <= `2`.
[![Build Status](https://travis-ci.org/hustcc/short-unique-string.svg?branch=master)](https://travis-ci.org/hustcc/short-unique-string)
[![Coverage Status](https://coveralls.io/repos/github/hustcc/short-unique-string/badge.svg)](https://coveralls.io/github/hustcc/short-unique-string)
[![npm](https://img.shields.io/npm/v/short-unique-string.svg)](https://www.npmjs.com/package/short-unique-string)## Usage
> **npm i --save short-unique-string**
```js
var generator = require('short-unique-string');var uniqueId = generator({
number: true,
symbol: true
})uniqueId(); // '0'
// ...
uniqueId(); // 'aY'
```Only one API `generator(opts)`, opts is the unique parameter which is a pure object:
- `number`: contain number string, default is `false`.
- `symbol`: contain symbol string, default is `false`.## License
MIT@[hustcc](https://github.com/hustcc).