Skip to content

return simple incremental ids for each named scope

License

Notifications You must be signed in to change notification settings

FuzzyRhombus/scopeid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

return simple incremental ids for each named scope

Resources

License

Stars

Watchers

Forks

Packages

No packages published