{"_id":"fixed-width-string","_rev":"6-0d0f93b447d8e45b71d38da8046f1c60","name":"fixed-width-string","description":"Terminal ANSI-aware string fit to fixed width","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"fixed-width-string","version":"1.0.0","description":"Terminal ANSI-aware string fit to fixed width","license":"MIT","repository":{"type":"git","url":"git+https://github.com/lahmatiy/fixed-width-string.git"},"author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"engines":{"node":">=0.10.0"},"main":"./index.js","files":["index.js"],"keywords":["string","text","padding","truncate","align","ellipsis","width","formatting","terminal","cli","console","ansi","color"],"devDependencies":{"chalk":"*","strip-ansi":"*","mocha":"*"},"scripts":{"test":"mocha"},"gitHead":"f966d2189e14466b8261a8f7a6b7ba504163630b","bugs":{"url":"https://github.com/lahmatiy/fixed-width-string/issues"},"homepage":"https://github.com/lahmatiy/fixed-width-string#readme","_id":"fixed-width-string@1.0.0","_shasum":"93bdbd03e6915cd265e396a1b7f3cc6b0880324d","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"lahmatiy","email":"rdvornov@gmail.com"},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"dist":{"shasum":"93bdbd03e6915cd265e396a1b7f3cc6b0880324d","tarball":"https://registry.npmjs.org/fixed-width-string/-/fixed-width-string-1.0.0.tgz","integrity":"sha512-rEwYW25brnK9DoUVEZ9a1FQWyHXmLWJlUyW0uSIqwWRWglhjeoOXmLl8brB9PTE79wxijuxvuVF+lMTeFJ4BLw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA7j+ryxIHHaP5sNFfBK3eVtNUH79AvD2+Uyr11ipuNmAiEAu93Nj5pPYEe1v3VR8rgA+jD3MxX9f00FzZwfXqf7NKI="}]},"directories":{}},"1.1.0":{"name":"fixed-width-string","version":"1.1.0","description":"Terminal ANSI-aware string fit to fixed width","license":"MIT","repository":{"type":"git","url":"git+https://github.com/lahmatiy/fixed-width-string.git"},"author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"engines":{"node":">=0.10.0"},"main":"./index.js","keywords":["string","text","padding","truncate","align","ellipsis","width","formatting","terminal","cli","console","ansi","color"],"devDependencies":{"chalk":"^3.0.0","strip-ansi":"^6.0.0","mocha":"^7.0.0"},"scripts":{"test":"mocha"},"gitHead":"0ca34f41338d11802a51b54a283762f8ba722f93","bugs":{"url":"https://github.com/lahmatiy/fixed-width-string/issues"},"homepage":"https://github.com/lahmatiy/fixed-width-string#readme","_id":"fixed-width-string@1.1.0","_nodeVersion":"13.5.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-2JF1I81c5nVH/13gmnmR7lFA6zkRGCCXnHjpRsoop2oNJSLwaJjPUS/sGGvohV1VK0EuU50PgLfCgKmFAG0lUw==","shasum":"823ca36d3b55163eccf2cf22f602ac87a811e265","tarball":"https://registry.npmjs.org/fixed-width-string/-/fixed-width-string-1.1.0.tgz","fileCount":5,"unpackedSize":7576,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeElclCRA9TVsSAnZWagAAwC4P/A8/KmjSFZ96+CLKk6Dj\nB8xGtkysVgxAwM+kd6wxnUBj2iU9IFhx4gGcK0Qus9NLJKATrOb3hPAf5Pqg\n3eyXuTiXCMfXb2OLo6548tMhNMOnw3CjEYOtwmtIHcBfZPc3gaqyL7kbg+oE\n4lZB6LRJLf1ne91jlshIVm7JIRoXzGCCU6RVfiGYVs/DunaRITdgiojkUOrZ\nQv7nvhISMuxfNLLdoSpwBWOMmT+51Uj0+9v+hXHqnRC52euLOAivWk1qKO4O\nekXCR2MBODu1FRrGU3oF8swjEq4OrE8us00ebj/7EWgx8ac3Ms/ldVmJ3MNT\nB/+W1LOsYZROjNb/S9x/qbAel54s4+yYSzfeEnfsUG0cd3xrDL1WbTuiDf1V\nvmlvNQEVjBqk20ijs+BSQoeoZ+1opqyWERbSKBq6LVXv/GDbuXs5Ol/NSomo\nW7OqbG4wxUDKuF7YKuXMtZ9sxyEET1DNG9Lu4PGmiLT43mL4rCHk/W+h6eM+\nqsCqdrmtk523r+k/wJUlMQXcBvOk2yCNzSH251ACHustuR/YHLJvdeNYPcCi\nE9dDT8AK1qx0cQl4Cy+hNVRzuDDrAFb2730eIhwy2n2m2qNeB7lxgmJM3r9Y\nnTh54lwrGQmlGvhQYncJS0ajqq5eLHKjm1DvIPPGZ3hSKMjAYxHV668XPk4v\nZB9H\r\n=9Cfa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEoKS0TdUlavFKZc/dRK3SiVuGXjyPIHAqkM/GN7ofqwIgQZmV6F08BmmrDc2PpXFvBELHJ6f7SDdbWwgiCpoCM8M="}]},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"_npmUser":{"name":"lahmatiy","email":"rdvornov@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fixed-width-string_1.1.0_1578260261219_0.22706347753524714"},"_hasShrinkwrap":false},"2.0.0":{"name":"fixed-width-string","version":"2.0.0","description":"Terminal ANSI-aware string fit to fixed width","license":"MIT","repository":{"type":"git","url":"git+https://github.com/lahmatiy/fixed-width-string.git"},"author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"engines":{"node":">=8.0.0"},"main":"./index.js","keywords":["string","text","padding","truncate","align","ellipsis","width","formatting","terminal","cli","console","ansi","color"],"scripts":{"lint":"eslint *.js","lint-and-test":"npm run lint && npm test","test":"mocha --reporter ${REPORTER:-progress}","coverage":"nyc npm test","travis":"nyc npm run lint-and-test && npm run coveralls","coveralls":"nyc report --reporter=text-lcov | coveralls"},"devDependencies":{"chalk":"^3.0.0","coveralls":"^3.0.11","eslint":"^6.5.1","mocha":"^7.0.0","nyc":"^14.1.0","strip-ansi":"^6.0.0"},"gitHead":"939c601df0d30931f2881871d68a08cadfb90b6a","bugs":{"url":"https://github.com/lahmatiy/fixed-width-string/issues"},"homepage":"https://github.com/lahmatiy/fixed-width-string#readme","_id":"fixed-width-string@2.0.0","_nodeVersion":"8.17.0","_npmVersion":"6.13.7","dist":{"integrity":"sha512-x0EEj6r54LPjESQpwtU6Dwxk08TSfXZrOGNsaHBOY9RUxepw8JZ8sZtrrvD1zqB3wMi1whvGflOugcSMlRVn4Q==","shasum":"c868790d564cafb3cd6dd6cfbed245777fa942a5","tarball":"https://registry.npmjs.org/fixed-width-string/-/fixed-width-string-2.0.0.tgz","fileCount":6,"unpackedSize":8899,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJevnMfCRA9TVsSAnZWagAAa8UP/jmz2KC3ReDqZFf7Af9v\noFkc91qhjeiXfCJszZFFc+V4KzVpbIzRCCtIQ/DMCmwXQ1NU7X7VS6juPL9u\nDq586FioIChHPIshMUZorjEhuRMLX5LaV3tz6apn4PAlwQSxP0C5aBygxx2I\nukrtRkdVAny/UeTo0SwFLZ/mNvzkcAEp/pab44q+arvtIxaeimrSOoCG5hdl\nJbXSry8mRTMqEYVsPQLFX087MwsMn0BKhQcyqiXKVbLBCpVX+MyRR7nU3XkR\nYxXLuhxiJWcXSFjIalUBPZmsVxsAo6QAL8e4362KzGy47t1I+TcIfweGM0oy\nrHqeCslUcN7Y/o43Bs+fMbYb8wcqSzXKTsHg10RQsk+3goiYzeXCgqtGF6MZ\n+7CbZBib+lPqXeYCQ/v4XuQPPOG5myVdfuAQMBux+gX1xOmmfUnxKpsN+nDz\nAlE44eaZyEg3xdbY+PfQ/OdzSeL8/451uohfhDp+T7DeXfCBvXTK4pKYZXJV\nEaH53Em9Zx+AZuMp5ntsN8a6RE8thk4wcbhGGNo4linFa+n67CFd8Ux6A0P7\nWS8wbX6ZFrsbEmox02Y+c2EZC/PVJEaWhL41Zbebc7S4F+xufTX4uiBKRp81\noNZHq6CLMsInpVc+cFfgppKhby6Wu6hr1epU8zzl5nTcmnW0rSn20BTU1nGu\ndEoH\r\n=g/os\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCzpW2VV6sQgtHfE0XrHZ+U1IyWTkO9foB6j2eJqAe+4QIhAPpyGOZSSTWQaQevDpZXiX5R7R98HORr1Z7JiNiQhUoY"}]},"maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"_npmUser":{"name":"lahmatiy","email":"rdvornov@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fixed-width-string_2.0.0_1589539615313_0.31064602175388467"},"_hasShrinkwrap":false}},"readme":"[![NPM version](https://img.shields.io/npm/v/fixed-width-string.svg)](https://www.npmjs.com/package/fixed-width-string)\n[![Build Status](https://travis-ci.org/lahmatiy/fixed-width-string.svg?branch=master)](https://travis-ci.org/lahmatiy/fixed-width-string)\n[![Coverage Status](https://coveralls.io/repos/github/lahmatiy/fixed-width-string/badge.svg?branch=master)](https://coveralls.io/github/lahmatiy/fixed-width-string?branch=master)\n\n\nFit a string to the fixed width (length) with aware of [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code).\n\nFeatures:\n\n- Works well with strings with ANSI escape codes, i.e strings styled with a lib like [chalk](https://github.com/chalk/chalk)\n- Pad or truncate string if needed\n- Align string\n\n## Install\n\n```\n$ npm install fixed-width-string\n```\n\n## Usage\n\n```js\nvar fixedWidthString = require('fixed-width-string');\n\nconsole.log(fixedWidthString('test', 10));\n// \"test      \"\n\nconsole.log(fixedWidthString('very long string', 10));\n// \"very long…\"\n\nconsole.log(fixedWidthString('very long string', { align: 'right' }));\n// \"…ng string\"\n\nvar chalk = require('chalk');\n\nconsole.log(fixedWidthString(chalk.green('hello') + ' ' + chalk.red('world'), 8));\n// \"\\u001b[32mhello\\u001b[39m \\u001b[31mw…\\u001b[39m\"\n//\n// but in terminal you'll see colored\n// \"hello w…\"\n```\n\n## API\n\n```js\nfixedWidthString(str, width[, options])\n```\n\n### options.padding\n\nString to padding with.\n\nDefault: `' '` (one space)\n\n```js\nconsole.log(fixedWidthString('test', 10));\n// \"test      \"\n\nconsole.log(fixedWidthString('test', 10, { padding: '.' }));\n// \"test......\"\n```\n\n### options.align\n\nSide to align.\n\nValues: `'left'` or `'right'`  \nDefault: `'left'`\n\n```js\nconsole.log(fixedWidthString('test', 10));\n// \"test      \"\n\nconsole.log(fixedWidthString('test', 10, { align: 'right' }));\n// \"      test\"\n```\n\n### options.ellipsis\n\nString to be placed when string is truncating.\n\nDefault: `'…'`\n\n> Note: To omit ellipsis, pass an empty string or falsy value for the option.\n\n```js\nconsole.log(fixedWidthString('hello world', 8));\n// \"hello w…\"\n\nconsole.log(fixedWidthString('hello world', 8, { ellipsis: '~' }));\n// \"hello w~\"\n\nconsole.log(fixedWidthString('hello world', 8, { ellipsis: '...', align: 'right' }));\n// \"...world\"\n\nconsole.log(fixedWidthString('hello world', 8, { ellipsis: false, align: 'right' }));\n// \"lo world\"\n```\n\n### options.truncate\n\nSide should be truncated.\n\nValues: `'left'` or `'right'`  \nDefault: `'right'` when `align: 'left'` or `'left'` when `align: 'right'`\n\n```js\nconsole.log(fixedWidthString('hello world', 8));\n// \"hello w…\"\n\nconsole.log(fixedWidthString('hello world', 8, { truncate: 'left' }));\n// \"…o world\"\n\nconsole.log(fixedWidthString('hello world', 8, { align: 'right' }));\n// \"hello w…\"\n\nconsole.log(fixedWidthString('hello world', 8, { align: 'right', truncate: 'left' }));\n// \"…o world\"\n```\n\n## License\n\nMIT\n","maintainers":[{"name":"lahmatiy","email":"rdvornov@gmail.com"}],"time":{"modified":"2022-06-18T01:49:05.180Z","created":"2015-09-02T23:22:48.381Z","1.0.0":"2015-09-02T23:22:48.381Z","1.1.0":"2020-01-05T21:37:41.362Z","2.0.0":"2020-05-15T10:46:55.427Z"},"homepage":"https://github.com/lahmatiy/fixed-width-string#readme","keywords":["string","text","padding","truncate","align","ellipsis","width","formatting","terminal","cli","console","ansi","color"],"repository":{"type":"git","url":"git+https://github.com/lahmatiy/fixed-width-string.git"},"author":{"name":"Roman Dvornov","email":"rdvornov@gmail.com"},"bugs":{"url":"https://github.com/lahmatiy/fixed-width-string/issues"},"license":"MIT","readmeFilename":"README.md"}