{"bugs":{"url":"https://github.com/pugjs/with/issues"},"dist":{"shasum":"ff49bc52404663935a56f4dbfa39350afc698e9b","tarball":"https://registry.npmjs.org/with/-/with-7.0.1-canary-2.tgz","fileCount":23,"integrity":"sha512-o4ehlRfzLyk+M3M0ZAAZSz+6NycholBh7DeKMnsUHt75TWfr+H8VfRA/QaKeym5LyOX6afZCFEWNhQ7RSO8+yQ==","signatures":[{"sig":"MEUCIQDhPbGSXwgq+7zt5EvbGBk5ynVKx4DhRmxtkebZjFJKMgIgU6E59oTQd1nO2pT3Eb/84mOscdchP6FjPS6IqpTJodA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":125054,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJezoM0CRA9TVsSAnZWagAAslMP/1tXBsm7DGtBL99S3uqZ\nWhU2IqTZGbLEexmo71LSrA13+ibi8kJ/nOJxmYvKTZuwWGT9iKtwE9m3gxDW\nQuOIi7w50HNgkKhvprjiu25Tyu2Dn9EegGp3rE5cy6LueZXCs8hkX8y2HfKq\n9YrNSvVRFbEnEEmkcrt7CBdSYCG4daYyexm4vR3LKMmJvP1KCdUxTv6DSBeE\n9bGiZJseJWPwEWGh3/hw4bVcPumfiLhne71CEdQY5UrKQgXqcZ5ImNRqxr1H\nQWZT47Z9tmKOa+VBEEu2PskSjXTlkn/Cn8hZbYr8OPREk8ZJva/lKT/x91Ll\nGKsyRw8A1qw7tY8ytqylCh6qaVvb88kH47xVpOpSrAa9NzIpxoYVcfIf9vxF\nkox0mJOD9YmZAQfl0NnScIf9qkpUXlGK0m59QFP3MdpUojZpqKTQqhv+SiRN\n66T0vOe9OFs4J/VuCgn4Ot9KJpgCEFmFAoIc5Q+LF9GvVYKirJ8INMB2b1xM\nGy8jXVoJaf1d29bag7Q41ZWQZR7Ok3PTEjmgGVPx3MXTSlFnGn9dDe0g4odt\nGbG+uK/OFrCKGslMPKVZZQ9C0SXgb+1+vu1fcYNi/wh+VSzvm5z0CSYrky/o\nc2w211OgFS4nawZSndwSp1Yq/c7ZHUdzON+tTv0vfMwWpGmYHboAk3U051Z3\nu5Gd\r\n=NCAe\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index.js","name":"with","author":{"name":"ForbesLindesay"},"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","engines":{"node":">= 10.0.0"},"gitHead":"02b8f64a1e298c68b4eff4c0fc6ee999cc3db783","license":"MIT","scripts":{"lint":"tslint './src/**/*.{ts,tsx}' -t verbose -p .","test":"mocha test/index.js -R spec","build":"tsc","pretest":"yarn build","postbuild":"rimraf lib/**/__tests__","prettier:check":"prettier --ignore-path .gitignore --list-different './**/*.{md,json,yaml,js,jsx,ts,tsx}'","prettier:write":"prettier --ignore-path .gitignore --write './**/*.{md,json,yaml,js,jsx,ts,tsx}'"},"_npmUser":{"name":"with-bot","email":"with-bot@rollingversions.com"},"homepage":"https://github.com/pugjs/with#readme","repository":{"url":"git+https://github.com/pugjs/with.git","type":"git"},"_npmVersion":"6.14.4","description":"Compile time `with` for strict mode JavaScript","directories":{},"maintainers":[{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},{"name":"with-bot","email":"with-bot@rollingversions.com"}],"_nodeVersion":"12.16.3","dependencies":{"babel-walk":"3.0.0-canary-5","@babel/types":"^7.9.6","assert-never":"^1.2.1","@babel/parser":"^7.9.6"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"mocha":"*","rimraf":"^3.0.2","tslint":"^6.1.2","prettier":"^2.0.5","uglify-js":"^2.6.2","typescript":"^3.9.3","@types/node":"^14.0.5","@forbeslindesay/tsconfig":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/with_7.0.1-canary-2_1590592308317_0.468911710433108","host":"s3://npm-registry-packages"},"_id":"with@7.0.1-canary-2","version":"7.0.1-canary-2"}