Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
sequential-ids
Advanced tools
A Node.js module that allows centralized generation of sequential, unique and human-readable ids.
Sample Id: ACB - 00423
Aspect | Detail |
---|---|
version | 0.0.0-alpha.1.0 |
dependencies | none |
last update | 2nd Sept, 2014 |
From npmjs:
$ npm install sequential-ids --save
var sequential = require("sequential-ids");
var generator = new sequential.Generator({
digits: 6,
letters: 3,
store: function (id) {
// assuming `db` is a variable holding a database object
// with the method `.store(value)`
db.store(id)
}
});
var accessor = new sequential.Accessor()
var id_x = accessor.next()
var id_y = accessor.next()
new Generator([options])
you only require to create a single generator instance
options object have:
digits
:
0
(zero) lets you ignore the number part6
.letters
:
0
(zero) lets you ignore the letters part3
.store
:
null
.store_freq
:
1
(called every 1 ID is generated)restore
:
digits
and letters
will be ignored so as to follow the restore ID style.null
.port
:
9876
.in a case where you may require more than one generator, you would allocate them to different ports. See ahead on how to target each of the different generators.
var sequential = require("sequential-ids");
var generatorA = new sequential.Generator({port: 8998});
var generatorB = new sequential.Generator({port: 7667});
new Accessor([port])
used to access ids.
port
is the port number of your generator. In case where, you did not specify a port when creating a Generator instance, you may leave this out. Defaults to 9876
.
an accessor has the following methods:
.next(callback)
:
.session(callback)
:
All methods are asynchronous, the Node.js way
.used(callback)
- passes the total number of IDs generated..semantics(callback)
- passes the remaining no. of ids to be generated before breaking our semantics specified while creating the generator.Sequential Ids and its source code are licensed under the [MIT][mit] license. See LICENSE file accompanying this text.
Copyright (c) 2014 Gocho Mugo mugo@forfuture.co.ke
FAQs
centralized generation of sequential, human-readable ids
The npm package sequential-ids receives a total of 24 weekly downloads. As such, sequential-ids popularity was classified as not popular.
We found that sequential-ids demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.