7.1.0 • Published 6 months ago

slice-ansi v7.1.0

Weekly downloads
23,878,477
License
MIT
Repository
github
Last release
6 months ago

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, startSlice, endSlice?)

string

Type: string

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

startSlice

Type: number

Zero-based index at which to start 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

tablelog-updatecli-truncate@huyhpham/rn-linearchetype-libraryeasy-select-rnreact-native-bluetooth2killi8n-react-native-fast-imagepipihome@icanpm/api-master@arisageha/react-lazyload@arisageha/react-lazyload-fix@oneplanetcrowd/developers@almeidaa/msreact-native-template-rfbaseairscanairscan-examplebb-chatreact-native-esc-pos-sahaab@borisovart/atol-kkt-moduledeneme323112@ntt_app/react-native-custom-notificationreact-native-custom-text-hwjamesreact-native-covid-sdkgql_din_modmutasi-bca@jttechnic/interpretercthpb-plugin-socialmysql-formatreact-native-printer-brothersrn-pdf-reader-offline@newhorizon-tech/dd-npm-package-templatereact-native-shekhar-bridge-testcogoportutilsukor-remasteruncoded-connect@reversodev/oceanic-fleetwilscanner@oiti/documentoscopy-react-native@respondea/cordova-plugin-v-inappbrowserquoc-testreact-native-slider-kf@infinitebrahmanuniverse/nolb-slic@prodam/prodam-typesplginexpand-react-bridgeopea-bootstraapluminos-ui-core@everything-registry/sub-chunk-2779jawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgp149-tablereact-native-jawwy_samplesam-carouselrn-adyen-dropinrn-agora-ios-mrn-counter-demojrennsoh88-react-native-scroll-indicatorrn-circular-chartrn-check-btnkhaled-salem-custom-componentsdotenv-corescrolexdogandev-simple-toastdesign-system-fitbank-450cypress-spellcheckresponsive-react-app@con-test/react-native-concent-commonreact-router-v5-v6-bridged-featuresreact-native-tejab41097-sample-libraryreact-native-teknoctrl-componentsreact-native-teads-sdk-modulereact-native-swalreact-native-test-viewreact-native-test-comlibraryreact-native-testwebreact-native-test-module-hhh@cs6/react-native-test-native-view-librarycpm-8ink-cjsink-scroll-promptsreact_native_pandey_marqueereact-native-ui-components-library@ct-note/image@ct-note/table@cute-apocalypse/react-treereact-otp-input-uptdreact-native-version-appreact-native-uvc-camera-android@devorso/dcountdownipullcreate-nano-moduleinkcotrader-dex-sdkcpcs6_loggercpm-12
7.0.0

6 months ago

7.1.0

6 months ago

6.0.0

1 year ago

5.0.0

3 years ago

4.0.0

4 years ago

3.0.0

5 years ago

2.1.0

5 years ago

2.0.0

6 years ago

1.0.0

7 years ago

0.1.0

7 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago