{"name":"line-numbers","version":"0.2.0","author":{"name":"Simon Lydell"},"license":"MIT","description":"Add line numbers to a string.","keywords":["line","number","numbers","file","add","insert","gutter","column","each"],"repository":{"type":"git","url":"https://github.com/lydell/line-numbers"},"scripts":{"test":"mocha --ui tdd"},"devDependencies":{"mocha":"^2.0.1"},"dependencies":{"left-pad":"0.0.3"},"readme":"Overview [![Build Status](https://travis-ci.org/lydell/line-numbers.svg?branch=master)](https://travis-ci.org/lydell/line-numbers)\n========\n\nAdd line numbers to a string.\n\n```js\nvar lineNumbers = require(\"line-numbers\")\n\nvar string = [\n  \"function sum(a, b) {\",\n  \"  return a + b;\",\n  \"}\"\n].join(\"\\n\")\n\nlineNumbers(string)\n// 1 | function sum(a, b) {\n// 2 |   return a + b;\n// 3 | }\n```\n\n\nInstallation\n============\n\n- `npm install line-numbers`\n\n```js\nvar lineNumbers = require(\"line-numbers\")\n```\n\n\nUsage\n=====\n\n### `lineNumbers(code, [options])` ###\n\nInserts a line number at the beginning of each line in `code`, which is either a\nstring or an array of strings—one for each line. All the line numbers are of the\nsame width; shorter numbers are padded on the left side.\n\nThe return value is of the same type as `code`.\n\n`options`:\n\n- start: `Number`. The number to use for the first line. Defaults to `1`.\n- padding: `String`. The character to pad numbers with. Defaults to `\" \"`.\n- before: `String`. String to put before the line number. Defaults to `\" \"`.\n- after: `String`. String to put between the line number and the line itself.\n  Defaults to `\" | \"`.\n- transform: `Function`. It is called for each line and passed an object with\n  the following properties:\n\n  - before: `options.before`\n  - number: `Number`. The current line number.\n  - width: `Number`. The padded width of the line numbers.\n  - after: `options.after`\n  - line: `String`. The current line.\n\n  You may modify the above properties to alter the line numbering for the\n  current line. This is useful if `before` and `after` aren’t enough, if you\n  want to colorize the line numbers, or highlight the current line.\n\n\nLicense\n=======\n\n[The X11 (“MIT”) License](LICENSE).\n","readmeFilename":"readme.md","bugs":{"url":"https://github.com/lydell/line-numbers/issues"},"homepage":"https://github.com/lydell/line-numbers","_id":"line-numbers@0.2.0","_shasum":"6bc028149440e570d495ab509692aa08bd779c6e","_from":"https://registry.npmjs.org/line-numbers/-/line-numbers-0.2.0.tgz","_resolved":"https://registry.npmjs.org/line-numbers/-/line-numbers-0.2.0.tgz"}