1.0.1 • Published 8 years ago

scopeid v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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

1.0.1

8 years ago

1.0.0

8 years ago