{"name":"slice-ansi","version":"7.1.2","keywords":["slice","string","ansi","styles","color","colour","colors","terminal","console","cli","tty","escape","formatting","rgb","256","shell","xterm","log","logging","command-line","text"],"license":"MIT","_id":"slice-ansi@7.1.2","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/chalk/slice-ansi#readme","bugs":{"url":"https://github.com/chalk/slice-ansi/issues"},"dist":{"shasum":"adf7be70aa6d72162d907cd0e6d5c11f507b5403","tarball":"http://registry-npm.ywwl.com/slice-ansi/download/slice-ansi-7.1.2.tgz","fileCount":5,"integrity":"sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==","signatures":[{"sig":"MEQCIBo4bceTb+E7OHuYKjTk2Qvt0yIR2hKIcG27kQkTJbWFAiAvAufaqMHvj6x53rGwuP5uRJ9oHFiqAFkTA+EMCl5Rhw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8035,"size":3180,"noattachment":false,"key":"/slice-ansi/-/slice-ansi-7.1.2.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=18"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/chalk/slice-ansi?sponsor=1","gitHead":"70f0071c9fe137a62505e3290226f904073aed6e","scripts":{"test":"xo && ava && tsc index.d.ts"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/chalk/slice-ansi.git","type":"git"},"_npmVersion":"10.9.2","description":"Slice a string with ANSI escape codes","directories":{},"sideEffects":false,"_nodeVersion":"22.12.0","dependencies":{"ansi-styles":"^6.2.1","is-fullwidth-code-point":"^5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.56.0","ava":"^5.3.1","chalk":"^5.3.0","strip-ansi":"^7.1.0","random-item":"^4.0.1"},"_npmOperationalInternal":{"tmp":"tmp/slice-ansi_7.1.2_1757344315700_0.5415780084018533","host":"s3://npm-registry-packages-npm-production"},"readme":"# slice-ansi [![XO: Linted](https://img.shields.io/badge/xo-linted-blue.svg)](https://github.com/xojs/xo)\n\n> Slice a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)\n\n## Install\n\n```sh\nnpm install slice-ansi\n```\n\n## Usage\n\n```js\nimport chalk from 'chalk';\nimport sliceAnsi from 'slice-ansi';\n\nconst string = 'The quick brown ' + chalk.red('fox jumped over ') +\n\t'the lazy ' + chalk.green('dog and then ran away with the unicorn.');\n\nconsole.log(sliceAnsi(string, 20, 30));\n```\n\n## API\n\n### sliceAnsi(string, startSlice, endSlice?)\n\n#### string\n\nType: `string`\n\nString with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk).\n\n#### startSlice\n\nType: `number`\n\nZero-based visible-column index at which to start the slice. Grapheme clusters (for example, emoji sequences and combining marks) are kept intact.\n\n#### endSlice\n\nType: `number`\n\nZero-based visible-column index at which to end the slice.\nIf a full grapheme cluster would cross `endSlice`, it is excluded.\n\n## Related\n\n- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes\n- [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal\n- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right\n\n## Maintainers\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [Josh Junon](https://github.com/qix-)\n","publish_time":1757344315899,"_cnpm_publish_time":1757344315899,"dist-tags":{"latest":"10.0.0"}}