![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
fast-word-wrap
Advanced tools
Readme
a fast and simple node.js package for getting a paragraph wrapped at a fixed line length
fast-word-wrap
has been proven (see benchmark) to be faster than wordwrap (28x), wrap-text (10x) and word-wrap (8x)
$ npm install fast-word-wrap
const wrap = require("fast-word-wrap");
const str = "The quick brown fox jumps over the lazy dog."; // the newline-free string to wrap
const cpl = 10; // the maximum number of characters per line
result = wrap(str, cpl);
console.log(result); // "The quick\nbrown fox\njumps over\nthe lazy\ndog.\n"
outputs
The quick
brown fox
jumps over
the lazy
dog.
fast-word-wrap
won't work correctly if the input string contains newlines; if that's the case, simply do
partials = [];
for (p of str.split("\n").filter(s => s)) {
partials.push(wrap(p, cpl));
}
result = partials.join("");
$ npm test test/unit.js
outputs
> fast-word-wrap@1.0.0 test /home/ale/dev/fast-word-wrap
> ava --verbose "test/unit.js"
✔ no wrap
ℹ The quick brown fox jumps over the lazy dog.
✔ wrap
ℹ The quick
brown fox
jumps over
the lazy
dog.
✔ do your best
ℹ The
quick
brown
fox
jumps
over
the
lazy
dog.
✔ wrap a fragment of "El inmortal" by Jorge Luis Borges
ℹ [output omitted for brevity in readme]
─
4 tests passed
$ npm test test/benchmark.js
outputs in my laptop
> fast-word-wrap@1.0.0 test /home/ale/dev/fast-word-wrap
> ava --verbose "test/benchmark.js"
✔ wrap faster than others (5.6s)
ℹ Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
ℹ wrapping 10000 times with each package a fragment of "El inmortal" by Jorge Luis Borges...
ℹ wordwrap took 3432.02 ms
ℹ wrap-text took 1185.77 ms
ℹ word-wrap took 948.94 ms
ℹ fast-word-wrap took 123.29 ms
─
1 test passed
the fragment used for testing is a transcription I did from my copy of "Nueva antología personal" by Jorge Luis Borges (ed. Emecé, 1st edition, 1968); I manually wrapped it at 80 characters per line to get the golden master
FAQs
a fast and simple node.js package for getting a paragraph wrapped at a fixed line length
The npm package fast-word-wrap receives a total of 291 weekly downloads. As such, fast-word-wrap popularity was classified as not popular.
We found that fast-word-wrap 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.