Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Word wrapping with both greedy and balanced (Minimum raggedness) implementations.
Word wrapping with both greedy and balanced (Minimum raggedness) implementations.
Install with npm
$ npm install fair-lines --save
var wrap = require('fair-lines');
var text = "On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, they cannot foresee the pain and trouble that are bound to ensue."
var result = wrap.basic(text, { width: 35 });
Results in:
On the other hand, we denounce with
righteous indignation and dislike
men who are so beguiled and
demoralized by the charms of
pleasure of the moment, so blinded
by desire, they cannot foresee the
pain and trouble that are bound to
ensue.
var wrap = require('fair-lines');
var text = "On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, they cannot foresee the pain and trouble that are bound to ensue."
var result = wrap.balanced(text, { width: 35 });
Results in:
On the other hand, we denounce
with righteous indignation and
dislike men who are so beguiled
and demoralized by the charms
of pleasure of the moment, so
blinded by desire, they cannot
foresee the pain and trouble
that are bound to ensue.
Type: Number
Default: 30
The line wrapping length
Example:
wrap.balanced(text, {width: 50});
Type: Number
Default: 0
The indentation width at the beginning of each line.
Example:
wrap.balanced(text, {indent: 10});
Type: Boolean
Default: false
Whether or not to respect new line breaks of the text in the output.
Example:
wrap.balanced(text, {respectNL: true});
Copyright © 2015 Moustafa Badawy Released under the MIT license.
FAQs
Word wrapping with both greedy and balanced (Minimum raggedness) implementations.
We found that fair-lines 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
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.