{
  "_args": [
    [
      {
        "raw": "redeyed@~1.0.0",
        "scope": null,
        "escapedName": "redeyed",
        "name": "redeyed",
        "rawSpec": "~1.0.0",
        "spec": ">=1.0.0 <1.1.0",
        "type": "range"
      },
      "/home/travis/build/lukesargeant/ember-sparkline/node_modules/cardinal"
    ]
  ],
  "_from": "redeyed@>=1.0.0 <1.1.0",
  "_id": "redeyed@1.0.1",
  "_inCache": true,
  "_location": "/redeyed",
  "_nodeVersion": "6.9.2-pre",
  "_npmOperationalInternal": {
    "host": "packages-18-east.internal.npmjs.com",
    "tmp": "tmp/redeyed-1.0.1.tgz_1477504514782_0.6673275073990226"
  },
  "_npmUser": {
    "name": "thlorenz",
    "email": "thlorenz@gmx.de"
  },
  "_npmVersion": "2.15.11",
  "_phantomChildren": {},
  "_requested": {
    "raw": "redeyed@~1.0.0",
    "scope": null,
    "escapedName": "redeyed",
    "name": "redeyed",
    "rawSpec": "~1.0.0",
    "spec": ">=1.0.0 <1.1.0",
    "type": "range"
  },
  "_requiredBy": [
    "/cardinal"
  ],
  "_resolved": "https://registry.npmjs.org/redeyed/-/redeyed-1.0.1.tgz",
  "_shasum": "e96c193b40c0816b00aec842698e61185e55498a",
  "_shrinkwrap": null,
  "_spec": "redeyed@~1.0.0",
  "_where": "/home/travis/build/lukesargeant/ember-sparkline/node_modules/cardinal",
  "author": {
    "name": "Thorsten Lorenz",
    "email": "thlorenz@gmx.de",
    "url": "thlorenz.com"
  },
  "bugs": {
    "url": "https://github.com/thlorenz/redeyed/issues"
  },
  "dependencies": {
    "esprima": "~3.0.0"
  },
  "description": "Takes JavaScript code, along with a config and returns the original code with tokens wrapped as configured.",
  "devDependencies": {
    "cardinal": "~0.4.4",
    "readdirp": "~0.3.3",
    "tap": "~5.7.0"
  },
  "directories": {},
  "dist": {
    "shasum": "e96c193b40c0816b00aec842698e61185e55498a",
    "tarball": "https://registry.npmjs.org/redeyed/-/redeyed-1.0.1.tgz"
  },
  "gitHead": "8e0a38c0e512cb52da4d204d8e2f9c9dfd81bc0b",
  "homepage": "https://github.com/thlorenz/redeyed#readme",
  "keywords": [
    "ast",
    "syntax",
    "tree",
    "source",
    "wrap",
    "metadata"
  ],
  "license": "MIT",
  "main": "redeyed.js",
  "maintainers": [
    {
      "name": "thlorenz",
      "email": "thlorenz@gmx.de"
    }
  ],
  "name": "redeyed",
  "optionalDependencies": {},
  "readme": "# redeyed [![build status](https://secure.travis-ci.org/thlorenz/redeyed.png?branch=master)](http://travis-ci.org/thlorenz/redeyed)\n\n*Add color to your JavaScript!*\n\n![frog](http://allaboutfrogs.org/gallery/photos/redeyes/red1.gif)\n\n[Red Eyed Tree Frog](http://allaboutfrogs.org/info/species/redeye.html) *(Agalychnis callidryas)*\n\n## What?\n\nTakes JavaScript code, along with a config and returns the original code with tokens wrapped and/or replaced as configured.\n\n## Where?\n\n- server side using nodejs\n- in the [browser](#browser-support)\n\n## What for?\n\nOne usecase is adding metadata to your code that can then be used to apply syntax highlighting.\n\n## How?\n\n- copy the [config.js](https://github.com/thlorenz/redeyed/blob/master/config.js) and edit it in order to specify how\n  certain tokens are to be surrounded/replaced\n- replace the `undefined` of each token you want to configure with one of the following\n\n### {String} config\n\n`'before:after'`\n\nwraps the token inside before/after \n\n### {Object} config\n\n`{ _before: 'before', _after: 'after' }`\n\nwraps token inside before/after\n\n#### Missing before and after resolution for {String} and {Object} config\n\nFor the `{String}` and `{Object}` configurations, 'before' or 'after' may be omitted:\n\n- `{String}`: \n  - `'before:'` (omitting 'after')\n  - `':after'` (omitting 'before')\n- `{Object}`: \n  - `{ _before: 'before' }` (omitting '_after')\n  - `{ _after: 'after' }` (omitting '_before')\n\nIn these cases the missing half is resolved as follows:\n\n- from the `parent._default` (i.e., `Keyword._default`) if found\n- otherwise from the `config._default` if found\n- otherwise `''` (empty string)\n\n### {Function} config\n\n`function (tokenString, info) { return {String}|{Object}; }`\n\n#### Inputs\n\n- tokenString: the content of the token that is currently being processed\n- info: an object with the following structure\n\n```js\n{\n    // {Int}\n    // the index of the token being processed inside tokens\n    tokenIndex\n\n    // {Array}\n    // all tokens that are being processed including comments \n    // (i.e. the result of merging esprima tokens and comments)\n  , tokens  \n\n    // {Object} \n    // the abstract syntax tree of the parsed code\n  , ast  \n\n    // {String}\n    // the code that was parsed (same string as the one passed to redeyed(code ..)\n  , code\n}\n```\n\nIn most cases the `tokenString` is all you need. The extra info object is passed in case you need to gather more\ninformation about the `token`'s surroundings in order to decide how to transform it. \nSee: [replace-log-example](https://github.com/thlorenz/redeyed/blob/master/examples/replace-log.js)\n\n#### Output\n\nYou can return a {String} or an {Object} from a {Function} config.\n\n- when returning a {String}, the token value will be replaced with it\n- when returning an {Object}, it should be of the following form:\n\n```js\n{\n    // {String}\n    // the string that should be substituted for the value of the current and all skipped tokens\n    replacement\n\n    // {Object} (Token)\n    // the token after which processing should continue\n    // all tokens in between the current one and this one inclusive will be ignored\n  , skipPastToken\n}\n```\n\n### Transforming JavaScript code\n\n***redeyed(code, config[, opts])***\n\nInvoke redeyed with your **config**uration, a **code** snippet and maybe **opts** as in the below example:\n\n```javascript\nvar redeyed = require('redeyed')\n  , config = require('./path/to/config')\n  , code = 'var a = 3;'\n  , result;\n\n// redeyed will throw an error (caused by the esprima parser) if the code has invalid javascript\ntry {\n  result = redeyed(code, config);\n  console.log(result.code);\n} catch(err) {\n  console.error(err);\n}\n```\n\n***opts***:\n```js\n{ // {Boolean}\n  // if true `result.ast` property contains the abstract syntax tree of the code\n  // if false (default) `result.ast` is not assigned and therefore `undefined`\n  buildAst: true|false\n  // {Boolean}\n  // if true `result.code` is not assigned and therefore `undefined`\n  // if false (default) `result.code` property contains the result of `split.join`\n  nojoin: true|false\n  // {Object}\n  // overrides default parser `esprima-fb` and needs to be compatible with it\n  parser: require('esprima') \n}\n```\n\n***return value***:\n\n```js\n{   ast      \n  , tokens   \n  , comments \n  , splits   \n  , code     \n}\n```\n\n- ast `{Array}`: [abstract syntax tree](http://en.wikipedia.org/wiki/Abstract_syntax_tree) as returned by [esprima\n  parse](http://en.wikipedia.org/wiki/Abstract_syntax_tree)\n- tokens `{Array}`: [tokens](http://en.wikipedia.org/wiki/Token_(parser)) provided by esprima (excluding\n  comments)\n- comments `{Array}`: block and line comments as provided by esprima\n- splits `{Array}`: code pieces split up, some of which where transformed as configured\n- code `{String}`: transformed code, same as `splits.join('')` unless this step has been skipped (see opts)\n\n## Browser Support\n\n### AMD\n\nEnsure to include [esprima](https://github.com/ariya/esprima) as one of your dependencies\n\n```js\ndefine(['redeyed'], function (redeyed) {\n [ .. ]\n});\n```\n\n### Attached to global window object\n\nThe `redeyed {Function}` will be exposed globally as `window.redeyed` - big surprise!\n\n```html\n<script type=\"text/javascript\" src=\"https://unpkg.com/esprima\"></script>\n<script type=\"text/javascript\" src=\"https://unpkg.com/redeyed\"></script>\n```\n\n## redeyed in the wild\n\n- [cardinal](https://github.com/thlorenz/cardinal): Syntax highlights JavaScript code with ANSI colors to be printed to\n  the terminal\n- [peacock](http://thlorenz.github.com/peacock/): JavaScript syntax highlighter that generates html that is compatible\n  with pygments styles.\n\n## Examples\n\n- `npm explore redeyed; npm demo` will let you try the [browser example](https://github.com/thlorenz/redeyed/tree/master/examples/browser)\n- `npm explore redeyed; npm demo-log` will let you try the [replace log example](https://github.com/thlorenz/redeyed/blob/master/examples/replace-log.js)\n\n",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git://github.com/thlorenz/redeyed.git"
  },
  "scripts": {
    "demo": "cd examples/browser; open index.html",
    "demo-log": "node examples/replace-log",
    "test": "tap test/*.js"
  },
  "version": "1.0.1"
}
