{ "_id": "align-text", "_rev": "16-d23eb231cd03aa3199feeada73bfca27", "name": "align-text", "description": "Align the text in a string.", "dist-tags": { "latest": "1.0.2" }, "versions": { "0.1.0": { "name": "align-text", "description": "Align the text in a string.", "version": "0.1.0", "homepage": "https://github.com/jonschlinkert/align-text", "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" }, "repository": { "type": "git", "url": "git://github.com/jonschlinkert/align-text.git" }, "bugs": { "url": "https://github.com/jonschlinkert/align-text/issues" }, "license": { "type": "MIT", "url": "https://github.com/jonschlinkert/align-text/blob/master/LICENSE" }, "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "dependencies": { "kind-of": "^1.1.0", "longest": "^1.0.0", "repeat-string": "^1.5.0" }, "devDependencies": { "mocha": "*", "should": "*" }, "_id": "align-text@0.1.0", "_shasum": "f6f56827796073f8d4cd76f09013dfa932e7d4de", "_from": ".", "_npmVersion": "2.5.1", "_nodeVersion": "0.12.0", "_npmUser": { "name": "jonschlinkert", "email": "github@sellside.com" }, "maintainers": [ { "name": "jonschlinkert", "email": "github@sellside.com" } ], "dist": { "shasum": "f6f56827796073f8d4cd76f09013dfa932e7d4de", "tarball": "https://registry.npmjs.org/align-text/-/align-text-0.1.0.tgz" }, "directories": {} }, "0.1.1": { "name": "align-text", "description": "Align the text in a string.", "version": "0.1.1", "homepage": "https://github.com/jonschlinkert/align-text", "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" }, "repository": { "type": "git", "url": "git://github.com/jonschlinkert/align-text.git" }, "bugs": { "url": "https://github.com/jonschlinkert/align-text/issues" }, "license": { "type": "MIT", "url": "https://github.com/jonschlinkert/align-text/blob/master/LICENSE" }, "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "dependencies": { "kind-of": "^1.1.0", "longest": "^1.0.0", "repeat-string": "^1.5.0" }, "devDependencies": { "mocha": "*", "should": "*" }, "keywords": [ "align", "align-center", "alignment", "center", "center-align", "indent", "pad", "padding", "right", "right-align", "text", "typography" ], "gitHead": "a9e730143b6232af063e0a0f436364ebe9151ede", "_id": "align-text@0.1.1", "_shasum": "576a56ded8fca0a9840c05064a0e93f35771b29f", "_from": ".", "_npmVersion": "2.5.1", "_nodeVersion": "0.12.0", "_npmUser": { "name": "jonschlinkert", "email": "github@sellside.com" }, "maintainers": [ { "name": "jonschlinkert", "email": "github@sellside.com" } ], "dist": { "shasum": "576a56ded8fca0a9840c05064a0e93f35771b29f", "tarball": "https://registry.npmjs.org/align-text/-/align-text-0.1.1.tgz" }, "directories": {} }, "0.1.2": { "name": "align-text", "description": "Align the text in a string.", "version": "0.1.2", "homepage": "https://github.com/jonschlinkert/align-text", "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" }, "repository": { "type": "git", "url": "git://github.com/jonschlinkert/align-text.git" }, "bugs": { "url": "https://github.com/jonschlinkert/align-text/issues" }, "license": "MIT", "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "dependencies": { "kind-of": "^2.0.0", "longest": "^1.0.1", "repeat-string": "^1.5.2" }, "devDependencies": { "mocha": "*", "should": "*", "word-wrap": "^1.0.3" }, "keywords": [ "align", "align-center", "alignment", "center", "center-align", "indent", "pad", "padding", "right", "right-align", "text", "typography" ], "gitHead": "b6149117f9d494fa5e31241b7d211e8f24b6c351", "_id": "align-text@0.1.2", "_shasum": "a926fa1550d23d75336fca03b6746a685739353a", "_from": ".", "_npmVersion": "2.10.1", "_nodeVersion": "0.12.4", "_npmUser": { "name": "jonschlinkert", "email": "github@sellside.com" }, "maintainers": [ { "name": "jonschlinkert", "email": "github@sellside.com" } ], "dist": { "shasum": "a926fa1550d23d75336fca03b6746a685739353a", "tarball": "https://registry.npmjs.org/align-text/-/align-text-0.1.2.tgz" }, "directories": {} }, "0.1.3": { "name": "align-text", "description": "Align the text in a string.", "version": "0.1.3", "homepage": "https://github.com/jonschlinkert/align-text", "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" }, "repository": { "type": "git", "url": "git://github.com/jonschlinkert/align-text.git" }, "bugs": { "url": "https://github.com/jonschlinkert/align-text/issues" }, "license": "MIT", "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "dependencies": { "kind-of": "^2.0.0", "longest": "^1.0.1", "repeat-string": "^1.5.2" }, "devDependencies": { "mocha": "*", "should": "*", "word-wrap": "^1.0.3" }, "keywords": [ "align", "align-center", "alignment", "center", "center-align", "indent", "pad", "padding", "right", "right-align", "text", "typography" ], "gitHead": "11c2e834ff2c63f9844bddf189fea5cab921e44d", "_id": "align-text@0.1.3", "_shasum": "72db3983872eec2313919c9426a993a41afe93f7", "_from": ".", "_npmVersion": "2.10.1", "_nodeVersion": "0.12.4", "_npmUser": { "name": "jonschlinkert", "email": "github@sellside.com" }, "maintainers": [ { "name": "jonschlinkert", "email": "github@sellside.com" } ], "dist": { "shasum": "72db3983872eec2313919c9426a993a41afe93f7", "tarball": "https://registry.npmjs.org/align-text/-/align-text-0.1.3.tgz" }, "directories": {} }, "0.1.4": { "name": "align-text", "description": "Align the text in a string.", "version": "0.1.4", "homepage": "https://github.com/jonschlinkert/align-text", "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" }, "repository": { "type": "git", "url": "git://github.com/jonschlinkert/align-text.git" }, "bugs": { "url": "https://github.com/jonschlinkert/align-text/issues" }, "license": "MIT", "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "dependencies": { "kind-of": "^3.0.2", "longest": "^1.0.1", "repeat-string": "^1.5.2" }, "devDependencies": { "mocha": "*", "should": "*", "word-wrap": "^1.0.3" }, "keywords": [ "align", "align-center", "alignment", "center", "center-align", "indent", "pad", "padding", "right", "right-align", "text", "typography" ], "gitHead": "7f08e823a54c6bda319d875895813537a66a4c5e", "_id": "align-text@0.1.4", "_shasum": "0cd90a561093f35d0a99256c22b7069433fad117", "_from": ".", "_npmVersion": "3.6.0", "_nodeVersion": "5.5.0", "_npmUser": { "name": "shinnn", "email": "snnskwtnb@gmail.com" }, "maintainers": [ { "name": "jonschlinkert", "email": "github@sellside.com" }, { "name": "shinnn", "email": "snnskwtnb@gmail.com" } ], "dist": { "shasum": "0cd90a561093f35d0a99256c22b7069433fad117", "tarball": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz" }, "_npmOperationalInternal": { "host": "packages-9-west.internal.npmjs.com", "tmp": "tmp/align-text-0.1.4.tgz_1454377856920_0.9624228512402624" }, "directories": {} }, "1.0.0": { "name": "align-text", "description": "Align the text in a string.", "version": "1.0.0", "homepage": "https://github.com/jonschlinkert/align-text", "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" }, "contributors": [ { "name": "Jon Schlinkert", "url": "http://twitter.com/jonschlinkert" }, { "name": "Shinnosuke Watanabe", "url": "https://shinnn.github.io" } ], "repository": { "type": "git", "url": "git+https://github.com/jonschlinkert/align-text.git" }, "bugs": { "url": "https://github.com/jonschlinkert/align-text/issues" }, "license": "MIT", "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "dependencies": { "kind-of": "^4.0.0", "longest": "^2.0.1", "repeat-string": "^1.6.1" }, "devDependencies": { "word-wrap": "^1.2.2", "gulp-format-md": "^0.1.12" }, "keywords": [ "align", "align-center", "alignment", "center", "center-align", "indent", "pad", "padding", "right", "right-align", "text", "typography" ], "verb": { "toc": false, "layout": "default", "tasks": [ "readme" ], "plugins": [ "gulp-format-md" ], "lint": { "reflinks": true } }, "gitHead": "f9845d37ba5cf9007bba10bf8aaf35114d08c53a", "_id": "align-text@1.0.0", "_shasum": "84db79afa0dc32e0424be15642f144cb0adf888b", "_from": ".", "_npmVersion": "4.6.1", "_nodeVersion": "7.7.3", "_npmUser": { "name": "jonschlinkert", "email": "github@sellside.com" }, "maintainers": [ { "name": "doowb", "email": "brian.woodward@gmail.com" }, { "name": "jonschlinkert", "email": "github@sellside.com" }, { "name": "shinnn", "email": "snnskwtnb@gmail.com" } ], "dist": { "shasum": "84db79afa0dc32e0424be15642f144cb0adf888b", "tarball": "https://registry.npmjs.org/align-text/-/align-text-1.0.0.tgz" }, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/align-text-1.0.0.tgz_1495774052756_0.7010780372656882" }, "directories": {} }, "1.0.1": { "name": "align-text", "description": "Align the text in a string.", "version": "1.0.1", "homepage": "https://github.com/jonschlinkert/align-text", "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" }, "contributors": [ { "name": "Jon Schlinkert", "url": "http://twitter.com/jonschlinkert" }, { "name": "Shinnosuke Watanabe", "url": "https://shinnn.github.io" } ], "repository": { "type": "git", "url": "git+https://github.com/jonschlinkert/align-text.git" }, "bugs": { "url": "https://github.com/jonschlinkert/align-text/issues" }, "license": "MIT", "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "dependencies": { "kind-of": "^5.0.2", "longest": "^2.0.1", "repeat-string": "^1.6.1" }, "devDependencies": { "gulp-format-md": "^1.0.0", "mocha": "^3.5.3", "word-wrap": "^1.2.3" }, "keywords": [ "align", "align-center", "alignment", "center", "center-align", "indent", "pad", "padding", "right", "right-align", "text", "typography" ], "verb": { "toc": false, "layout": "default", "tasks": [ "readme" ], "plugins": [ "gulp-format-md" ], "lint": { "reflinks": true } }, "gitHead": "f8dafe53ae67eb6e9026f9319fd43503baf613aa", "_id": "align-text@1.0.1", "_npmVersion": "5.4.1", "_nodeVersion": "8.4.0", "_npmUser": { "name": "jonschlinkert", "email": "github@sellside.com" }, "maintainers": [ { "name": "doowb", "email": "brian.woodward@gmail.com" }, { "name": "jonschlinkert", "email": "github@sellside.com" }, { "name": "shinnn", "email": "snnskwtnb@gmail.com" } ], "dist": { "integrity": "sha512-RiGevjTRRsUgt/T3dEgbQycuyPW916ayUb4y+yG8URCHz4mN0oFyQ8E0Zd2tpQww5RGgIdvO6ZXIsPfGSKFO9Q==", "shasum": "e8ff22bb0d4fe60ae9b0da1c8ad91c0eb1c4e036", "tarball": "https://registry.npmjs.org/align-text/-/align-text-1.0.1.tgz" }, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/align-text-1.0.1.tgz_1505302438280_0.8984816842712462" }, "directories": {} }, "1.0.2": { "name": "align-text", "description": "Align the text in a string.", "version": "1.0.2", "homepage": "https://github.com/jonschlinkert/align-text", "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" }, "contributors": [ { "name": "Jon Schlinkert", "url": "http://twitter.com/jonschlinkert" }, { "name": "Shinnosuke Watanabe", "url": "https://shinnn.github.io" } ], "repository": { "type": "git", "url": "git+https://github.com/jonschlinkert/align-text.git" }, "bugs": { "url": "https://github.com/jonschlinkert/align-text/issues" }, "license": "MIT", "files": [ "index.js" ], "main": "index.js", "engines": { "node": ">=0.10.0" }, "scripts": { "test": "mocha" }, "dependencies": { "kind-of": "^5.0.2", "longest": "^2.0.1", "repeat-string": "^1.6.1" }, "devDependencies": { "gulp-format-md": "^1.0.0", "mocha": "^3.5.3", "word-wrap": "^1.2.3" }, "keywords": [ "align", "align-center", "alignment", "center", "center-align", "indent", "pad", "padding", "right", "right-align", "text", "typography" ], "verb": { "toc": false, "layout": "default", "tasks": [ "readme" ], "plugins": [ "gulp-format-md" ], "lint": { "reflinks": true } }, "gitHead": "f43f4732a690cd97e563f842247f227b5182ec77", "_id": "align-text@1.0.2", "_npmVersion": "5.4.1", "_nodeVersion": "8.4.0", "_npmUser": { "name": "jonschlinkert", "email": "github@sellside.com" }, "maintainers": [ { "name": "doowb", "email": "brian.woodward@gmail.com" }, { "name": "jonschlinkert", "email": "github@sellside.com" }, { "name": "shinnn", "email": "snnskwtnb@gmail.com" } ], "dist": { "integrity": "sha512-uBPDs72zrRTdiTBY0YjBbuBOdXtRyT4qsKPb4bL4O7vH4utz/7KjwTJVsVbdThxMbVzkRGAfk8Ml3xoMvXSEYw==", "shasum": "d35cf1c99bc16089af1b2a887683adcb7e6ca68a", "tarball": "https://registry.npmjs.org/align-text/-/align-text-1.0.2.tgz" }, "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/align-text-1.0.2.tgz_1505302470161_0.43850269448012114" }, "directories": {} } }, "readme": "# align-text [![NPM version](https://img.shields.io/npm/v/align-text.svg?style=flat)](https://www.npmjs.com/package/align-text) [![NPM monthly downloads](https://img.shields.io/npm/dm/align-text.svg?style=flat)](https://npmjs.org/package/align-text) [![NPM total downloads](https://img.shields.io/npm/dt/align-text.svg?style=flat)](https://npmjs.org/package/align-text) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/align-text.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/align-text)\n\n> Align the text in a string.\n\nFollow this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), for updates on this project and others.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save align-text\n```\n\n## Usage\n\n```js\nvar align = require('align-text');\n\nalign(text, function_or_integer);\n```\n\n**Params**\n\n* `text` can be a **string or array**. If a string is passed, a string will be returned. If an array is passed, an array will be returned.\n* `function|integer`: if an integer, the text will be indented by that amount. If a transform function is passed, it must return an object with an `integer` property or an integer representing the amount of leading indentation to use as `align` loops over each line.\n\n**Example**\n\n```js\nalign(text, 4);\n```\n\nWould align:\n\n```\nabc\nabc\nabc\n```\nTo:\n\n```\n abc\n abc\n abc\n```\n\n## Transform function\n\n### params\n\nThe callback is used to determine the indentation of each line and gets the following params:\n\n* `len` the length of the \"current\" line\n* `longest` the length of the longest line\n* `line` the current line (string) being aligned\n* `lines` the array of all lines\n\n### return\n\nThe callback may return:\n\n* an integer that represents the number of spaces to use for padding,\n* or an object with the following properties:\n - `indent`: **{Number}** the amount of indentation to use. Default is `0` when an object is returned.\n - `character`: **{String}** the character to use for indentation. Default is `''` (empty string) when an object is returned.\n - `prefix`: **{String}** leading characters to use at the beginning of each line. `''` (empty string) when an object is returned.\n\n**Integer example:**\n\n```js\n// calculate half the difference between the length\n// of the current line and the longest line\nfunction centerAlign(len, longest, line, lines) {\n return Math.floor((longest - len) / 2);\n}\n```\n\n**Object example:**\n\n```js\nfunction centerAlign(len, longest, line, lines) {\n return {\n character: '\\t',\n indent: Math.floor((longest - len) / 2),\n prefix: '~ ',\n }\n}\n```\n\n## Usage examples\n\nAlign text values in an array:\n\n```js\nalign([1, 2, 3, 100]);\n//=> [' 1', ' 2', ' 3', '100']\n```\n\nOr [do stuff like this](./example.js):\n\n![screen shot 2015-06-09 at 2 08 34 am](https://cloud.githubusercontent.com/assets/383994/8051597/7b716fbc-0e4c-11e5-9aef-4493fd22db58.png)\n\nVisit [the example](./example.js) to see how this works.\n\n### Center align\n\nUsing the `centerAlign` function from above:\n\n```js\nalign(text, centerAlign);\n```\n\nWould align this text:\n\n```js\nLorem ipsum dolor sit amet\nconsectetur adipiscin\nelit, sed do eiusmod tempor incididun\nut labore et dolor\nmagna aliqua. Ut enim ad mini\nveniam, quis\n```\n\nResulting in this:\n\n```\n Lorem ipsum dolor sit amet,\n consectetur adipiscing\nelit, sed do eiusmod tempor incididunt\n ut labore et dolore\n magna aliqua. Ut enim ad minim\n veniam, quis\n```\n\n**Customize**\n\nIf you wanted to add more padding on the left, just pass the number in the callback.\n\nFor example, to add 4 spaces before every line:\n\n```js\nfunction centerAlign(len, longest, line, lines) {\n return 4 + Math.floor((longest - len) / 2);\n}\n```\n\nWould result in:\n\n```\n Lorem ipsum dolor sit amet,\n consectetur adipiscing\n elit, sed do eiusmod tempor incididunt\n ut labore et dolore\n magna aliqua. Ut enim ad minim\n veniam, quis\n```\n\n### Bullets\n\n```js\nalign(text, function (len, max, line, lines) {\n return {prefix: ' - '};\n});\n```\nWould return:\n\n```\n- Lorem ipsum dolor sit amet,\n- consectetur adipiscing\n- elit, sed do eiusmod tempor incididunt\n- ut labore et dolore\n- magna aliqua. Ut enim ad minim\n- veniam, quis\n```\n\n### Different indent character\n\n```js\nalign(text, function (len, max, line, lines) {\n return { \n indent: Math.floor((max - len) / 2), \n character: '~', \n };\n});\n```\nWould return\n\n```\n~~~~~Lorem ipsum dolor sit amet,\n~~~~~~~~consectetur adipiscing\nelit, sed do eiusmod tempor incididunt\n~~~~~~~~~ut labore et dolore\n~~~~magna aliqua. Ut enim ad minim\n~~~~~~~~~~~~~veniam, quis\n```\n\n## About\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 14 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 2 | [shinnn](https://github.com/shinnn) |\n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n### Running tests\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on September 13, 2017._", "maintainers": [ { "email": "brian.woodward@gmail.com", "name": "doowb" }, { "email": "snnskwtnb@gmail.com", "name": "shinnn" }, { "email": "github@sellside.com", "name": "jonschlinkert" } ], "time": { "modified": "2018-02-06T08:34:55.921Z", "created": "2015-03-08T01:03:18.899Z", "0.1.0": "2015-03-08T01:03:18.899Z", "0.1.1": "2015-03-08T01:25:47.262Z", "0.1.2": "2015-06-09T06:23:28.614Z", "0.1.3": "2015-06-09T06:25:00.237Z", "0.1.4": "2016-02-02T01:50:57.618Z", "1.0.0": "2017-05-26T04:47:33.816Z", "1.0.1": "2017-09-13T11:33:59.409Z", "1.0.2": "2017-09-13T11:34:31.117Z" }, "homepage": "https://github.com/jonschlinkert/align-text", "repository": { "type": "git", "url": "git+https://github.com/jonschlinkert/align-text.git" }, "author": { "name": "Jon Schlinkert", "url": "https://github.com/jonschlinkert" }, "bugs": { "url": "https://github.com/jonschlinkert/align-text/issues" }, "license": "MIT", "readmeFilename": "README.md", "keywords": [ "align", "align-center", "alignment", "center", "center-align", "indent", "pad", "padding", "right", "right-align", "text", "typography" ], "users": { "kkuehl": true, "kopepasah": true, "vivek.vikhere": true }, "contributors": [ { "name": "Jon Schlinkert", "url": "http://twitter.com/jonschlinkert" }, { "name": "Shinnosuke Watanabe", "url": "https://shinnn.github.io" } ], "_attachments": {} }