JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q52208F
  • License MIT

Yet another unique alphanumeric id generator

Package Exports

  • anid

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 (anid) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

anid

Yet another unique alphanumeric id generator.

  • mixed case by default (L1kETH4t)
  • lower case option (l1keth4t)
  • string length option
  • very fast at default length (8 characters)
  • reasonably fast at maximum length (24 characters)
  • uses cryptographically insecure Math.random()
  • UMD format, works in Node.js and browsers
  • small footprint

Build Status Coverage Status gzip size MIT license

Installation

NPM

npm i -S anid

Yarn

yarn add anid

API

Anid([length = 8, [lowercase = false]])

Returns a function that generates alphanumeric unique id string.

Usage

Node.js

const Anid = require('anid');

const anid = Anid();
const anidLowercase = Anid(null, true);
const anidLong = Anid(24);

console.log(anid()); // mXAL9KWY
console.log(anidLowercase()); // pumlrb7e
console.log(anidLong()); // NIJ174LksMaOOmykKkYce2UC

Browser

<script src="https://unpkg.com/anid/dist/anid.min.js"></script>
<script>

var anid = Anid();
var anidLowercase = Anid(null, true);
var anidLong = Anid(24);

console.log(anid()); // mXAL9KWY
console.log(anidLowercase()); // pumlrb7e
console.log(anidLong()); // NIJ174LksMaOOmykKkYce2UC

</script>

License

MIT