Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@types/wrap-ansi
Advanced tools
Stub TypeScript definitions entry for wrap-ansi, which provides its own types definitions
@types/wrap-ansi provides TypeScript type definitions for the wrap-ansi package, which is used to wrap words to a specified width while preserving ANSI escape codes.
Wrap text to a specified width
This feature allows you to wrap a string of text to a specified width. In this example, the input string is wrapped to a width of 20 characters.
const wrapAnsi = require('wrap-ansi');
const input = 'The quick brown fox jumps over the lazy dog';
const output = wrapAnsi(input, 20);
console.log(output);
Preserve ANSI escape codes
This feature ensures that ANSI escape codes are preserved when wrapping text. In this example, the input string contains ANSI escape codes for red text, and these codes are preserved in the output.
const wrapAnsi = require('wrap-ansi');
const input = '\u001B[31mThe quick brown fox jumps over the lazy dog\u001B[39m';
const output = wrapAnsi(input, 20);
console.log(output);
Hard wrapping
This feature allows for hard wrapping, which means that words will be split if they exceed the specified width. In this example, the input string is hard-wrapped to a width of 20 characters.
const wrapAnsi = require('wrap-ansi');
const input = 'The quick brown fox jumps over the lazy dog';
const output = wrapAnsi(input, 20, { hard: true });
console.log(output);
The word-wrap package provides similar functionality for wrapping text to a specified width, but it does not handle ANSI escape codes. It is simpler and more lightweight compared to wrap-ansi.
The cli-width package is used to get the width of the terminal, which can be useful in conjunction with wrap-ansi for dynamically wrapping text based on the terminal width. It does not provide text wrapping functionality by itself.
The slice-ansi package is used to slice a string containing ANSI escape codes without breaking the codes. It can be used in combination with other text-wrapping libraries to handle ANSI escape codes properly.
This is a stub types definition for @types/wrap-ansi (https://github.com/chalk/wrap-ansi#readme).
wrap-ansi provides its own type definitions, so you don't need @types/wrap-ansi installed!
FAQs
Stub TypeScript definitions entry for wrap-ansi, which provides its own types definitions
The npm package @types/wrap-ansi receives a total of 2,483,953 weekly downloads. As such, @types/wrap-ansi popularity was classified as popular.
We found that @types/wrap-ansi 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.