
Security News
minimatch Patches 3 High-Severity ReDoS Vulnerabilities
minimatch patched three high-severity ReDoS vulnerabilities that can stall the Node.js event loop, and Socket has released free certified patches.
Increment strings or generate sequential string ids in node.js or browser
nextStr = incstr(str,
[alphabet=incstr.alphabet],
[numberlike=incstr.numberlike])
str - string to increment;alphabet - alphabet to use (default 'A..Za..z0..9');numberlike - 'BA' after '9' instead of 'AA'(default false);alphabet can be set through incstr.alphabet;numberlike can be set through incstr.numberlike;nextId = incstr.idGenerator(options)
id = nextId() // real generator would be too bulky "nextId.next().value"
Possible options:
options.lastId;options.alphabet;options.numberlike;options.prefix;options.suffix.lastId can also be accessed later through nextId.lastId property.
Note that nextId() is much faster than incstr() and safer because it verifies uniqueness of chars in the alphabet.
Pass a string to increment using default alphabet:
let i = incstr() // "A"
i = incstr(i) // "B"
...
i = incstr(i) // "9"
i = incstr(i) // "AA"
i = incstr(i) // "AB"
Pass a string and an alphabet to use:
incstr("ccc", "abc") // "aaaa"
incstr("cc", "ab") // throws ('c' is not in alphabet 'ab')
incstr("0", "01") // "1"
incstr("1", "01") // "00", note NOT "10"
incstr("1", "01", true) // "10", numberlike increment
Generate ids:
const nextId = incstr.idGenerator()
id1 = nextId() // 'A'
id2 = nextId() // 'B'
const nextId = incstr.idGenerator({alphabet:'ab', prefix:'id_', suffix:''})
nextId() // 'id_a'
nextId() // 'id_b'
nextId() // 'id_aa'
const nextId = incstr.idGenerator({lastId:'cc', alphabet:'abc', numberlike: true})
id = nextId() // 'baa'
FAQs
Increment string or generate sequential string ids
The npm package incstr receives a total of 17,393 weekly downloads. As such, incstr popularity was classified as popular.
We found that incstr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
minimatch patched three high-severity ReDoS vulnerabilities that can stall the Node.js event loop, and Socket has released free certified patches.

Research
/Security News
Socket uncovered 26 malicious npm packages tied to North Korea's Contagious Interview campaign, retrieving a live 9-module infostealer and RAT from the adversary's C2.

Research
An impersonated golang.org/x/crypto clone exfiltrates passwords, executes a remote shell stager, and delivers a Rekoobe backdoor on Linux.