UNPKG

canonical

Version:

Canonical code style linter and formatter for JavaScript, SCSS and CSS.

69 lines (68 loc) 3.69 kB
{ "_args": [ [ "line-numbers@https://registry.npmjs.org/line-numbers/-/line-numbers-0.2.0.tgz", "/Users/gajus/Documents/dev/canonical-code-style/canonical" ] ], "_from": "line-numbers@>=0.2.0 <0.3.0", "_id": "line-numbers@0.2.0", "_inCache": true, "_location": "/line-numbers", "_phantomChildren": {}, "_requested": { "name": "line-numbers", "raw": "line-numbers@https://registry.npmjs.org/line-numbers/-/line-numbers-0.2.0.tgz", "rawSpec": "https://registry.npmjs.org/line-numbers/-/line-numbers-0.2.0.tgz", "scope": null, "spec": "https://registry.npmjs.org/line-numbers/-/line-numbers-0.2.0.tgz", "type": "remote" }, "_requiredBy": [ "/babel-code-frame", "/babel-core" ], "_resolved": "https://registry.npmjs.org/line-numbers/-/line-numbers-0.2.0.tgz", "_shasum": "6bc028149440e570d495ab509692aa08bd779c6e", "_shrinkwrap": null, "_spec": "line-numbers@https://registry.npmjs.org/line-numbers/-/line-numbers-0.2.0.tgz", "_where": "/Users/gajus/Documents/dev/canonical-code-style/canonical", "author": { "name": "Simon Lydell" }, "bugs": { "url": "https://github.com/lydell/line-numbers/issues" }, "dependencies": { "left-pad": "0.0.3" }, "description": "Add line numbers to a string.", "devDependencies": { "mocha": "^2.0.1" }, "homepage": "https://github.com/lydell/line-numbers#readme", "keywords": [ "add", "column", "each", "file", "gutter", "insert", "line", "number", "numbers" ], "license": "MIT", "name": "line-numbers", "optionalDependencies": {}, "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", "repository": { "type": "git", "url": "git+https://github.com/lydell/line-numbers.git" }, "scripts": { "test": "mocha --ui tdd" }, "version": "0.2.0" }