
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
ansi-construct
Advanced tools
[](https://www.npmjs.com/package/ansi-construct)
Construct ANSI colors strings from object descriptors.
import { ansi } from 'ansi-construct'
const item = ansi({ text: 'foo', color: ['red', 'bold'], padStart: 5 })
// change it after creation
item.padStart = 6
// stringify
console.log(`${item}`) // ' foo'
import { ansi } from 'ansi-construct'
const items = [
ansi({ text: 'foo', color: ['red', 'bold'], padStart: 5 }),
ansi({ text: 'bar', color: 'underline' }),
ansi('baz', 'blue'),
]
// stringify
console.log(items.join('')) // ' foo\n\u001b[4mbar\u001b[0mbaz\u001b[0m'
import type { AnsiItem } from 'ansi-construct'
import { construct } from 'ansi-construct'
const items: AnsiItem[] = [
{ text: 'foo', color: 'red', padStart: 5 },
{ text: 'bar', color: ['green', 'bold', 'underline'] },
' raw text ',
{ t: 'shorthand', c: 'cyan' }
]
console.log(construct(items)) // '\x1b[31mfoo\x1b[0m \x1b[32mbar\x1b[0m raw text \x1b[36m\x1b[0m'
MIT License © 2022 Anthony Fu
FAQs
[](https://www.npmjs.com/package/ansi-construct)
The npm package ansi-construct receives a total of 8 weekly downloads. As such, ansi-construct popularity was classified as not popular.
We found that ansi-construct 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.