
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@minga/text-clipper
Advanced tools
Fast and correct clip functions for HTML and plain text.
Written by Arend van Beelen jr. @ Speakap.
text-clipper offers the following advantages over similar libraries that allow clipping HTML:
Make sure you have Node.js installed and run:
$ npm install text-clipper
Basic example:
var clip = require('text-clipper');
var clippedString = clip(string, 80); // returns a string of at most 80 characters
You can also specify options:
var clippedHtml = clip(htmlString, 140, { html: true, maxLines: 5 });
By default, text-clipper tries to break only at word boundaries so words don't get clipped halfway.
Set this option to true
if you want words to be broken up.
By default, text-clipper treats the input string as plain text. This is undesirable if the input
string is HTML, because it might result in broken HTML tags. Set this option to true
to make
text-clipper treat the input as HTML, in which case it will try to always return valid HTML,
provided the input is valid as well.
The amount of characters to assume for images. This is used whenever an image is encountered, but also for embedded SVG and MathML content. The default is 2.
The amount of characters to assume for newlines. This is used whenever a newline is encountered. By default this is 1.
The string to insert to indicate the string was clipped. Default: '…'
.
Note the indicator is only inserted when the clipping doesn't occur at a line-break.
Maximum amount of lines allowed. If given, the string will be clipped either at the moment the maximum amount of characters is exceeded or the moment maxLines newlines are discovered, whichever comes first.
Note when in HTML mode, block-level elements trigger newlines and text-clipper assumes the text
will be displayed with a CSS white-space setting that treats \n
as a line break. Of course the
HTML tag <br>
is also counted.
FAQs
Fast and correct clip functions for HTML and plain text.
The npm package @minga/text-clipper receives a total of 0 weekly downloads. As such, @minga/text-clipper popularity was classified as not popular.
We found that @minga/text-clipper 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.