slice-ansi

WebJar for slice-ansi

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

slice-ansi
Last Version

Last Version

2.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

slice-ansi
WebJar for slice-ansi
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/chalk/slice-ansi

Download slice-ansi

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/slice-ansi/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>slice-ansi</artifactId>
    <version>2.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/slice-ansi/
implementation 'org.webjars.npm:slice-ansi:2.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/slice-ansi/
implementation ("org.webjars.npm:slice-ansi:2.1.0")
'org.webjars.npm:slice-ansi:jar:2.1.0'
<dependency org="org.webjars.npm" name="slice-ansi" rev="2.1.0">
  <artifact name="slice-ansi" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='slice-ansi', version='2.1.0')
)
libraryDependencies += "org.webjars.npm" % "slice-ansi" % "2.1.0"
[org.webjars.npm/slice-ansi "2.1.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.webjars.npm : ansi-styles jar [3.2.0,4)
org.webjars.npm : astral-regex jar [1.0.0,2)
org.webjars.npm : is-fullwidth-code-point jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

slice-ansi Build Status XO: Linted

Slice a string with ANSI escape codes

Install

$ npm install slice-ansi

Usage

const chalk = require('chalk');
const sliceAnsi = require('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.

Related

  • 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.
org.webjars.npm

chalk

Terminal string styling done right

Versions

Version
2.1.0
1.0.0
0.0.4