{"_id":"slice-ansi@10.0.0","bugs":{"url":"https://github.com/chalk/slice-ansi/issues"},"dist":{"shasum":"4b8db63bb7fa6dec3ccc650158d4597e567ebc59","tarball":"http://registry-npm.ywwl.com/slice-ansi/download/slice-ansi-10.0.0.tgz","fileCount":6,"integrity":"sha512-2rOYDG420YH3p2PbRAu6LdYnGuMZldshqZS2qqFh/WEzAytVo7b8n1HhubLtRunvqjao74MmGfW4sY4ex0YvpQ==","signatures":[{"sig":"MEUCIQCWul9cqNMXE0l8lEFIxQGP1MNYz+GkI7ypvf/ZnKc0pwIgYL47hBkiM/uoWS9tyv8KrQ0H98eX3x6BtUcBcEupss8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAVhlfU/X5jCSIUalqpy4apSHPCdZn5e6TaQG8qfG83XAiEAsndH13WpJBwaRtkVOLB0gWodMpPnh2fyKgHdJe4vqV8="}],"unpackedSize":31993,"size":8061,"noattachment":false,"key":"/slice-ansi/-/slice-ansi-10.0.0.tgz"},"name":"slice-ansi","type":"module","types":"./index.d.ts","engines":{"node":">=22"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/chalk/slice-ansi?sponsor=1","gitHead":"6814553f9844af671007dc2a621db354143f6858","license":"MIT","scripts":{"test":"xo && node --test && tsc --lib esnext index.d.ts"},"version":"10.0.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"homepage":"https://github.com/chalk/slice-ansi#readme","keywords":["slice","string","ansi","styles","color","colour","colors","terminal","console","cli","tty","escape","formatting","rgb","256","shell","xterm","log","logging","command-line","text"],"repository":{"url":"git+https://github.com/chalk/slice-ansi.git","type":"git"},"_npmVersion":"12.2.0","description":"Slice a string with ANSI escape codes","directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"sideEffects":false,"_nodeVersion":"26.12.1","dependencies":{"ansi-styles":"^7.0.0","string-width":"^8.3.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^5.0.1","chalk":"^6.0.1","strip-ansi":"^7.2.0","random-item":"^4.0.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/slice-ansi_10.0.0_1793440556979_0.5754168597351504"},"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\nColumns are counted the same way as [`string-width`](https://github.com/sindresorhus/string-width).\n\n> [!NOTE]\n> Tabs and other control characters take no columns. Replace tabs with spaces first if you need tab stops.\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":1793440557130,"_cnpm_publish_time":1793440557130,"dist-tags":{"latest":"10.0.0"}}