{"name":"with","version":"7.0.0-canary-1","description":"Compile time `with` for strict mode JavaScript","main":"lib/index.js","scripts":{"build":"tsc","postbuild":"rimraf lib/**/__tests__","lint":"tslint './src/**/*.{ts,tsx}' -t verbose -p .","prettier:write":"prettier --ignore-path .gitignore --write './**/*.{md,json,yaml,js,jsx,ts,tsx}'","prettier:check":"prettier --ignore-path .gitignore --list-different './**/*.{md,json,yaml,js,jsx,ts,tsx}'","pretest":"yarn build","test":"mocha test/index.js -R spec"},"repository":{"type":"git","url":"git+https://github.com/pugjs/with.git"},"author":{"name":"ForbesLindesay"},"license":"MIT","dependencies":{"@babel/parser":"^7.9.6","@babel/types":"^7.9.6","assert-never":"^1.2.1","babel-walk":"3.0.0-canary-5"},"devDependencies":{"@forbeslindesay/tsconfig":"^2.0.0","@types/node":"^14.0.5","mocha":"*","prettier":"^2.0.5","rimraf":"^3.0.2","tslint":"^6.1.2","typescript":"^3.9.3","uglify-js":"^2.6.2"},"engines":{"node":">= 10.0.0"},"readme":"# with\n\nCompile time `with` for strict mode JavaScript\n\n[![Build Status](https://img.shields.io/github/workflow/status/pugjs/with/Publish%20Canary/master?style=for-the-badge)](https://github.com/pugjs/with/actions?query=workflow%3A%22Publish+Canary%22)\n[![Rolling Versions](https://img.shields.io/badge/Rolling%20Versions-Enabled-brightgreen?style=for-the-badge)](https://rollingversions.com/pugjs/with)\n[![NPM version](https://img.shields.io/npm/v/with?style=for-the-badge)](https://www.npmjs.com/package/with)\n\n## Installation\n\n    $ npm install with\n\n## Usage\n\n```js\nvar addWith = require('with');\n\naddWith('obj', 'console.log(a)');\n// => ';(function (console, a) {\n//       console.log(a)\n//     }(\"console\" in obj ? obj.console :\n//                          typeof console!==\"undefined\" ? console : undefined,\n//       \"a\" in obj ? obj.a :\n//                    typeof a !== \"undefined\" ? a : undefined));'\n\naddWith('obj', 'console.log(a)', ['console']);\n// => ';(function (console, a) {\n//       console.log(a)\n//     }(\"a\" in obj ? obj.a :\n//                    typeof a !== \"undefined\" ? a : undefined));'\n```\n\n## API\n\n### addWith(obj, src[, exclude])\n\nThe idea is that this is roughly equivallent to:\n\n```js\nwith (obj) {\n  src;\n}\n```\n\nThere are a few differences though. For starters, assignments to variables will always remain contained within the with block.\n\ne.g.\n\n```js\nvar foo = 'foo';\nwith ({}) {\n  foo = 'bar';\n}\nassert(foo === 'bar'); // => This fails for compile time with but passes for native with\n\nvar obj = {foo: 'foo'};\nwith ({}) {\n  foo = 'bar';\n}\nassert(obj.foo === 'bar'); // => This fails for compile time with but passes for native with\n```\n\nIt also makes everything be declared, so you can always do:\n\n```js\nif (foo === undefined)\n```\n\ninstead of\n\n```js\nif (typeof foo === 'undefined')\n```\n\nThis is not the case if foo is in `exclude`. If a variable is excluded, we ignore it entirely. This is useful if you know a variable will be global as it can lead to efficiency improvements.\n\nIt is also safe to use in strict mode (unlike `with`) and it minifies properly (`with` disables virtually all minification).\n\n#### Parsing Errors\n\nwith internally uses babylon to parse code passed to `addWith`. If babylon throws an error, probably due to a syntax error, `addWith` returns an error wrapping the babylon error, so you can\nretrieve location information. `error.component` is `\"src\"` if the error is in the body or `\"obj\"` if it's in the object part of the with expression. `error.babylonError` is\nthe error thrown from babylon.\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"6d6c0c0285340090f80208a1e330516834cf8824","bugs":{"url":"https://github.com/pugjs/with/issues"},"homepage":"https://github.com/pugjs/with#readme","_id":"with@7.0.0-canary-1","_nodeVersion":"12.16.3","_npmVersion":"6.14.4","dist":{"integrity":"sha512-bnGuF64KsHLMIRtvHiIs9hdaFNklirIR4KaqPpdKdLQmcrQnivIbkA6ORxGZ54prVIJ+4JelTQ3bNt8iEMlICQ==","shasum":"de105b79b83668cfd45dd4d6347d06fcd020b872","tarball":"http://registry-npm.ywwl.com/with/download/with-7.0.0-canary-1.tgz","fileCount":23,"unpackedSize":124897,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJezEcaCRA9TVsSAnZWagAApNcP/2pulFH+Nizt/RtGDB3j\nxL61PvvFxRyyMN9mA9kG0J3WXWvndLK0o2H3FZ4Qp3bCCDFolS3kJQbbmvfH\nZ+KTxuCxnx1Yvf74oVKPXWsdfqaZUcI+MzjBAEcar5ldYWf5y+zfU32M3ZYm\nwDAvt33Y5k2CiAEfOoy9EdW+J8SO3kSLe7CZpAzSDI42fHVBwx+YwswcntO/\nyQHiaynML0fij+MpnS3IY+xslyYK7jpJF86g01JWw/5OJMiGZGT/8StZClc6\ngPYIn3jwDplvefoETYfZi+0yEU9YKLKQu6M+M9s4rQwZ7JaRBY1JB+biyswv\n+CKR8dV9+MGlnb+o42f9xy766Kyz5HRgmSpwm3dc5GgW7dngTMqwJuDuopmS\nKO2XH3W/QN+HZmfQBoSRW4JG8To8+awcnogvxc40d4EF/wvua/BjwLXWf8J+\n5pi/nzNV5bjD6Wpqkfof4Foa898Pi8Q0P0ArWPhRR3uvvNvbq1+dfWAfSjSx\n6MYf9x58jEeq1q4rbeYZHhvryNfgUvSDWrXyIfRq86dQOjcTCYUzBlDLSzEX\nDyGWQ6D8xOmGV1gIPZlaV9m5EUHFgJ94wr0CCFZenM8WSPvS2d+SnRE99Owi\nwwt7BAUBr1namQQ/Yfqu5mvKyzwmic9Mq33CwyYw0Z1s9l235dyM4Ao5lQK0\nFvFa\r\n=9qxk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCnxycVfFMlz0t66yvTtUye8GUcf/sO62Vq1fwtsx+8tQIhAKfAalwCPFUEYhP/WzYSURNcYs+UV4HgzVyWgs3jx9RG"}],"size":19563,"noattachment":false,"key":"/with/-/with-7.0.0-canary-1.tgz"},"maintainers":[{"email":"forbes@lindesay.co.uk","name":"forbeslindesay"},{"email":"with-bot@rollingversions.com","name":"with-bot"}],"_npmUser":{"name":"with-bot","email":"with-bot@rollingversions.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/with_7.0.0-canary-1_1590445850256_0.0011167615742095904"},"_hasShrinkwrap":false,"publish_time":1590445850359,"_cnpm_publish_time":1590445850359,"dist-tags":{"canary":"7.0.2-canary-3","latest":"7.0.2"}}