{"name":"pac-resolver","version":"1.3.0","description":"Generates an asynchronous resolver function from a PAC file","main":"index.js","dependencies":{"co":"~3.0.6","netmask":"~1.0.4","degenerator":"~1.0.2","regenerator":"~0.8.13","thunkify":"~2.1.1","ip":"1.0.1"},"devDependencies":{"mocha":"2"},"scripts":{"test":"mocha --reporter spec"},"repository":{"type":"git","url":"git://github.com/TooTallNate/node-pac-resolver.git"},"keywords":["pac","file","proxy","resolve","dns"],"author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://n8.io/"},"license":"MIT","bugs":{"url":"https://github.com/TooTallNate/node-pac-resolver/issues"},"gitHead":"cfb9d4794d9cf80f7e0ac191d6f8d5448a428f06","homepage":"https://github.com/TooTallNate/node-pac-resolver#readme","_id":"pac-resolver@1.3.0","_shasum":"ae451b2fb7827ca1205d3bd10c610c97403fadf3","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.5.0","_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"dist":{"shasum":"ae451b2fb7827ca1205d3bd10c610c97403fadf3","tarball":"http://registry-npm.ywwl.com/pac-resolver/download/pac-resolver-1.3.0.tgz","integrity":"sha512-MsSdbonKlZqtCSCSGyIojdOdNiXDTl0h0O7o6GMXboLBw1K5IdxOq5ZgzqQFJyRxsVitSOufstLnkZqPYY4YYg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCt9NkMW+/YpOjVPD1Ix8+p3A7SY1OZtCkXvVL/GaTy0wIhANlKhLcsKWdfSF/2esiQUHqmS1neI0c57TNu7AC7QnrX"}],"size":11903,"noattachment":false,"key":"/pac-resolver/-/pac-resolver-1.3.0.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pac-resolver-1.3.0.tgz_1474907412658_0.2247973382472992"},"directories":{},"readme":"pac-resolver\n============\n### Generates an asynchronous resolver function from a [PAC file][pac-wikipedia]\n\n\nThis module accepts a JavaScript String of code, which is meant to be a\n[PAC proxy file][pac-wikipedia], and returns a generated asynchronous\n`FindProxyForURL()` function.\n\nExample\n-------\n\nGiven the PAC proxy file named `proxy.pac`:\n\n```js\nfunction FindProxyForURL(url, host) {\n  if (isInNet(myIpAddress(), \"10.1.10.0\", \"255.255.255.0\")) {\n    return \"PROXY 1.2.3.4:8080\";\n  } else {\n    return \"DIRECT\";\n  }\n}\n```\n\nYou can consume this PAC file with `pac-resolver` like so:\n\n```ts\nimport { readFileSync } from 'fs';\nimport { createPacResolver } from 'pac-resolver';\n\nconst FindProxyForURL = createPacResolver(readFileSync('proxy.pac'));\n\nconst res = await FindProxyForURL('http://foo.com/');\nconsole.log(res);\n// \"DIRECT\"\n```\n\n\nAPI\n---\n\n### pac(qjs: QuickJSWASMModule, pacFileContents: string | Buffer, options?: PacResolverOptions) → Function\n\nReturns an asynchronous `FindProxyForURL()` function based off of the given JS\nstring `pacFileContents` PAC proxy file. An optional `options` object may be\npassed in which respects the following options:\n\n * `filename` - String - the filename to use in error stack traces. Defaults to `proxy.pac`.\n * `sandbox` - Object - a map of functions to include in the sandbox of the\n JavaScript environment where the JS code will be executed. i.e. if you wanted to\n include the common `alert` function you could pass `alert: console.log`. For\n async functions, you must set the `async = true` property on the function\n instance, and the JS code will be able to invoke the function as if it were\n synchronous.\n\n The `qjs` parameter is a QuickJS module instance as returned from `getQuickJS()` from the `quickjs-emscripten` module.\n\n[pac-file-docs]: https://web.archive.org/web/20070602031929/http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html\n[pac-wikipedia]: http://wikipedia.org/wiki/Proxy_auto-config\n","publish_time":1474907414432,"_cnpm_publish_time":1474907414432,"dist-tags":{"latest":"9.0.2"}}