JSPM

niknik-uniqueid

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q29918F

Generate a unique sequential ID. Optionally pass a prefix, suffix, or multiplier.

Package Exports

  • niknik-uniqueid

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (niknik-uniqueid) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

uniqueid NPM version

Generate a unique sequential ID. Optionally pass a prefix, suffix, or multiplier.

Install

Install with npm:

npm i uniqueid --save-dev

Run tests

npm test

Usage

var uniqueId = require('uniqueid');
console.log(uniqueId('abc'));
//=> ['a', 'b', 'c'];

API

id

Generate a unique ID.

  • options {Object}: Optionally pass a prefix, suffix and/or `multiplier.
  • returns {String}: The unique id.

Optionally pass a prefix to prepend, a suffix to append, or a multiplier to use on the ID.

uniqueId(); //=> '25'

uniqueId({prefix: 'apple_'});
//=> 'apple_10'

uniqueId({suffix: '_orange'});
//=> '10_orange'

uniqueId({multiplier: 5});
//=> 5, 10, 15, 20...

To reset the id to zero, do id.reset().

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license


This file was generated by verb-cli on September 14, 2014.