-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
executable file
·35 lines (35 loc) · 2.23 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
"name": "with",
"version": "1.0.4",
"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": {
"lexical-scope": "0.0.12"
},
"devDependencies": {
"mocha": "~1.9.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])\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.\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@1.0.4",
"dist": {
"shasum": "f44a3cc9d3f0bcc1305e18c4b971ac8844d2fa13"
},
"_from": "with@1.0.4",
"_resolved": "http://registry.npmjs.org/with/-/with-1.0.4.tgz"
}