7.1.0 • Published 1 year ago

slice-ansi v7.1.0

Weekly downloads
23,878,477
License
MIT
Repository
github
Last release
1 year 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_samplegriffin-ui-librarytailwind-vector-effectsyncbackbasestemplewallet-eslint-pluginterminal-jumpertest-carosello-campustest-library-123test-haptik-libtest-npm-jjmessiwinx-form-winxweb-elements-iconswow.js-juziwifi_configuration_packagern-tm-notifyrn-use-modal-hookrn-currency-formatterrn-counter-demorn-session-multiplier-demorn_unique_device_idrnttlocksharingcomponent2samc2samc3samc4samc5sam-carouselscan-plugin-ionic-cjpshoppyfit-toolresponsive-react-appreactnativelyrn-check-btnrn-circular-chartrn-horizontal-listreact_native_pandey_marqueern-adyen-dropinrn-keyboard-avoiding-viewrn-my-libraryrn-pay-sdksuperset-plugin-chart-hello-world2supercluster-googlemaps-adapter-clonestechfox-icontechfox-react-feathersportscale-wifi-connect
7.0.0

1 year ago

7.1.0

1 year ago

6.0.0

2 years ago

5.0.0

4 years ago

4.0.0

5 years ago

3.0.0

5 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.0.0

8 years ago

0.1.0

8 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago