scopeid

1.0.1 • Public • Published

scopeid Build Status

Return simple incremental ids for each named scope

var scopeid = require('scopeid');
 
// no scope (default)
scopeid(); // 0
scopeid(); // 1
 
scopeid('test'); // 0
scopeid('test'); // 1
 
// scopes keep id counter separate
scopeid(); // 2

You can also return an id as a string instead of an integer:

scopeid.string(); // "0"

If .string is passed a scope the returned id will be prefixed with scope

scopeid.string('prefix-'); // "prefix-0"
scopeid.string('prefix-'); // "prefix-1"

Tests

Run tests using npm test

Package Sidebar

Install

npm i scopeid

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • rydm