Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

slice-ansi

Package Overview
Dependencies
2
Maintainers
2
Versions
10
Issues
File Explorer

Advanced tools

slice-ansi

Slice a string with ANSI escape codes

    5.0.0latest

Version published
Maintainers
2
Weekly downloads
34,016,331
decreased by-11.53%

Weekly downloads

Changelog

Source

Breaking

  • Require Node.js 12 8dee3ba
  • This package is now pure ESM. Please read this.

https://github.com/chalk/slice-ansi/compare/v4.0.0...v5.0.0

Readme

Source

slice-ansi XO: Linted

Slice a string with ANSI escape codes

Install

$ npm install slice-ansi

Usage

import chalk from 'chalk'; import sliceAnsi from 'slice-ansi'; const string = 'The quick brown ' + chalk.red('fox jumped over ') + 'the lazy ' + chalk.green('dog and then ran away with the unicorn.'); console.log(sliceAnsi(string, 20, 30));

API

sliceAnsi(string, beginSlice, endSlice?)

string

Type: string

String with ANSI escape codes. Like one styled by chalk.

beginSlice

Type: number

Zero-based index at which to begin the slice.

endSlice

Type: number

Zero-based index at which to end the slice.

  • wrap-ansi - Wordwrap a string with ANSI escape codes
  • cli-truncate - Truncate a string to a specific width in the terminal
  • chalk - Terminal string styling done right

Maintainers


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Keywords

FAQs

What is slice-ansi?

Slice a string with ANSI escape codes

Is slice-ansi popular?

The npm package slice-ansi receives a total of 27,066,445 weekly downloads. As such, slice-ansi popularity was classified as popular.

Is slice-ansi well maintained?

We found that slice-ansi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 2 open source maintainers collaborating on the project.

Last updated on 16 Apr 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc