Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
add-line-numbers
Advanced tools
Adds line numbers to a source string, padding left and starting at the given offset.
var addLineNumbers = require('add-line-numbers')
var stdin = require('get-stdin')
stdin(function (body) {
var src = addLineNumbers(body.toString())
process.stdout.write(src + '\n')
})
Now run the following in bash:
node example.js < some-file.js
Resulting output:
1: var addLineNumbers = require('./')
2: var test = require('tape')
3:
4: test('adds line numbers to a source string', function (t) {
5: t.equal(addLineNumbers([
6: 'one',
7: 'is second'
8: ].join('\r\n')), '1: one\n2: is second', 'return carriage')
9:
10: t.equal(addLineNumbers([
11: 'one',
12: 'is second'
13: ].join('\n'), 0), '0: one\n1: is second', 'start offset')
14:
...
str = addLineNumbers(str, start, delimiter)
Adds a number to the start of each line in the str
text.
start
(Number) number to start counting at, defaults to 1delimiter
(String) joins the number and line, defaults to ": "
Returns the transformed string.
MIT, see LICENSE.md for details.
FAQs
adds line numbers to a source string
The npm package add-line-numbers receives a total of 31,576 weekly downloads. As such, add-line-numbers popularity was classified as popular.
We found that add-line-numbers 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.