{"name":"pac-resolver","version":"5.0.0","description":"Generates an asynchronous resolver function from a PAC file","main":"./dist/index.js","types":"./dist/index.d.ts","dependencies":{"degenerator":"^3.0.1","ip":"^1.1.5","netmask":"^2.0.1"},"devDependencies":{"@types/debug":"4","@types/ip":"^1.1.0","@types/netmask":"^1.0.30","@types/node":"^12.12.11","@typescript-eslint/eslint-plugin":"1.6.0","@typescript-eslint/parser":"1.1.0","eslint":"5.16.0","eslint-config-airbnb":"17.1.0","eslint-config-prettier":"4.1.0","eslint-import-resolver-typescript":"1.1.1","eslint-plugin-import":"2.16.0","eslint-plugin-jsx-a11y":"6.2.1","eslint-plugin-react":"7.12.4","mocha":"^6.2.2","rimraf":"^3.0.0","typescript":"^4.3.5"},"scripts":{"prebuild":"rimraf dist","build":"tsc","test":"mocha --reporter spec","test-lint":"eslint src --ext .js,.ts","prepublishOnly":"npm run build"},"repository":{"type":"git","url":"git://github.com/TooTallNate/node-pac-resolver.git"},"engines":{"node":">= 8"},"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":"0439ff2eb790cffd812b2abf8a5b3343ea3c89db","homepage":"https://github.com/TooTallNate/node-pac-resolver#readme","_id":"pac-resolver@5.0.0","_nodeVersion":"14.17.3","_npmVersion":"7.19.1","dist":{"integrity":"sha512-H+/A6KitiHNNW+bxBKREk2MCGSxljfqRX76NjummWEYIat7ldVXRU3dhRIE3iXZ0nvGBk6smv3nntxKkzRL8NA==","shasum":"1d717a127b3d7a9407a16d6e1b012b13b9ba8dc0","tarball":"http://registry-npm.ywwl.com/pac-resolver/download/pac-resolver-5.0.0.tgz","fileCount":44,"unpackedSize":53027,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg7LgDCRA9TVsSAnZWagAAMfgQAIuyX+WxlHTu30a1W+9i\n3bVbWpw7wlCad3fM58mWn9HpvEPJQCgnrSC7AYwFVeh9IWBMx8SLIaxoJ3le\nqSNGdbIZDUV2H5+53yqWOpMQHcQ2o0v3ZS5RvNo7VzXQpgeXxN3dA1GU9Tc+\nvRXVTTOOqkz8w59pM41+xeHqhtWj9qrm9FgBoLDYCO6DDY7op0fLoNbGS12/\n4aPuwLT2HsImXV19lF4jQLUoyM3z7jycCNwTm2ZtdTiOiq3hn2OdfiHwiJYu\nlOkGicQulRB92g/LOlcGg9e8T05fpNvET5g29O2KUdxEQuLVr+c856aG2XNM\n8geoiC8QwU1jCe75HUuiN3INNTMw/JZ3IIMfDJk84S8nzqk5rokVe/15wnHg\nCAw0L2yeXBtN9rWpCmtiq7LA0SrxsSBowjuWW7s4AWu+/kP/sZGPLFciaJww\nopD7hSZdl8IXS3AsT8N12nrAhtSN/ShqmvPkOow2eKWX/MdNUWI1qPGVlxgb\nw12zBp8Dduy6iE3iRRu4piNPsBgqyTyMf9g0oSOMKlpeMg9uRPTkiYj53/gn\nXjgSogXzlPb7oWaIgHD0IIoybUpyMC27Rq4vVmV6lvdrWUfS0RtB5oy683HQ\nxCXq+qmGPcYvTaKYMtVnTqeyHmkccIQDnOUyajA6Oe1TgW8VkYTx5aSaUF5H\ncX6T\r\n=yGYK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB6eMbmaRH6rOJ15TJ65XQZnoXP52ClnwOhARpbaOE5PAiAzaaqxLhUPSGDqSTtxSpO+ODD/DGNB5USyCdVT3gyBkg=="}],"size":15299,"noattachment":false,"key":"/pac-resolver/-/pac-resolver-5.0.0.tgz"},"_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"directories":{},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pac-resolver_5.0.0_1626126339016_0.7277654948978483"},"_hasShrinkwrap":false,"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":1626126339175,"_cnpm_publish_time":1626126339175,"dist-tags":{"latest":"9.0.2"}}