{
  "name": "with",
  "version": "2.0.0",
  "description": "Compile time `with` for strict mode JavaScript",
  "main": "index.js",
  "scripts": {
    "test": "mocha -R spec"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/ForbesLindesay/with.git"
  },
  "author": {
    "name": "ForbesLindesay"
  },
  "license": "MIT",
  "dependencies": {
    "uglify-js": "2.4.0"
  },
  "devDependencies": {
    "mocha": "~1.12.0"
  },
  "readme": "# with\r\n\r\nCompile time `with` for strict mode JavaScript\r\n\r\n[![build status](https://secure.travis-ci.org/ForbesLindesay/with.png)](http://travis-ci.org/ForbesLindesay/with)\r\n[![Dependency Status](https://gemnasium.com/ForbesLindesay/with.png)](https://gemnasium.com/ForbesLindesay/with)\r\n[![NPM version](https://badge.fury.io/js/with.png)](http://badge.fury.io/js/with)\r\n\r\n## Installation\r\n\r\n    $ npm install with\r\n\r\n## Usage\r\n\r\n```js\r\nvar addWith = require('with')\r\n\r\naddWith('obj', 'console.log(a)')\r\n// => \"var a = obj.a;console.log(a)\"\r\n\r\naddWith(\"obj || {}\", \"console.log(helper(a))\", [\"helper\"])\r\n// => var locals = (obj || {}),a = locals.a;console.log(helper(a))\r\n```\r\n\r\n## API\r\n\r\n### addWith(obj, src, [exclude], [environments])\r\n\r\nThe idea is that this is roughly equivallent to:\r\n\r\n```js\r\nwith (obj) {\r\n  src\r\n}\r\n```\r\n\r\nThere are a few differences though.  For starters, it will be assumed that all variables used in `src` come from `obj` so any that don't (e.g. template helpers) need to have their names parsed to `exclude` as an array.  If you want to have browser globals available you can pass a collection of `environments`, e.g.\r\n\r\n```js\r\naddWith('obj', 'document.createElement(foo)', [], ['reservedVars', 'ecmaIdentifiers', 'nonstandard', 'browser'])\r\n```\r\n\r\nThe default environment is: `['reservedVars', 'ecmaIdentifiers', 'nonstandard', 'node']`\r\n\r\nIt also makes everything be declared, so you can always do:\r\n\r\n```js\r\nif (foo === undefined)\r\n```\r\n\r\ninstead of\r\n\r\n```js\r\nif (typeof foo === 'undefined')\r\n```\r\n\r\nIt is also safe to use in strict mode (unlike `with`) and it minifies properly (`with` disables virtually all minification).\r\n\r\n## License\r\n\r\n  MIT",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/ForbesLindesay/with/issues"
  },
  "homepage": "https://github.com/ForbesLindesay/with",
  "_id": "with@2.0.0",
  "_from": "with@~2.0.0"
}
