Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pac-resolver

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pac-resolver - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

29

CHANGELOG.md

@@ -0,5 +1,18 @@

3.0.0 / 2017-06-13
==================
* [[`bc67e2f3c6`](https://github.com/TooTallNate/node-pac-resolver/commit/bc67e2f3c6)] - **BREAKING**: return a Promise from `FindProxyForURL()` (Nathan Rajlich)
* [[`d75f37bd85`](https://github.com/TooTallNate/node-pac-resolver/commit/d75f37bd85)] - document Promise based API (Nathan Rajlich)
* [[`e746acef18`](https://github.com/TooTallNate/node-pac-resolver/commit/e746acef18)] - coerce the input JS into a String (Nathan Rajlich)
* [[`bb61571ec9`](https://github.com/TooTallNate/node-pac-resolver/commit/bb61571ec9)] - update "mocha" to v3.4.2 (Nathan Rajlich)
* [[`ab5177faa4`](https://github.com/TooTallNate/node-pac-resolver/commit/ab5177faa4)] - add "use strict" (Nathan Rajlich)
* [[`db58c2c5e8`](https://github.com/TooTallNate/node-pac-resolver/commit/db58c2c5e8)] - update dependencies (Nathan Rajlich)
* [[`28ddb49d7b`](https://github.com/TooTallNate/node-pac-resolver/commit/28ddb49d7b)] - remove Node.js 0.8 npm update command from Travis-CI (Nathan Rajlich)
* [[`2289c0478c`](https://github.com/TooTallNate/node-pac-resolver/commit/2289c0478c)] - fix commit URLs in changelog (Nathan Rajlich)
* [[`132efe7c15`](https://github.com/TooTallNate/node-pac-resolver/commit/132efe7c15)] - test Node 8 in Travis (Nathan Rajlich)
2.0.0 / 2016-09-26
==================
* [[`df860eb96b`](https://github.com/TooTallNate/pac-resolver/commit/df860eb96b)] - **BREAKING** remove "regenerator", drops Node.js < v1 support (Nathan Rajlich)
* [[`df860eb96b`](https://github.com/TooTallNate/node-pac-resolver/commit/df860eb96b)] - **BREAKING** remove "regenerator", drops Node.js < v1 support (Nathan Rajlich)

@@ -9,9 +22,9 @@ 1.3.0 / 2016-09-26

* [[`58a3f9e62e`](https://github.com/TooTallNate/pac-resolver/commit/58a3f9e62e)] - Implemented `timeRange` function (Utsav Kesharwani) (#15)
* [[`a93a815f0d`](https://github.com/TooTallNate/pac-resolver/commit/a93a815f0d)] - Implemented `weekdayRange` function (Utsav Kesharwani) (#14)
* [[`8af3e689eb`](https://github.com/TooTallNate/pac-resolver/commit/8af3e689eb)] - **test**: fix typo in test names (Nathan Rajlich)
* [[`e0ddf63765`](https://github.com/TooTallNate/pac-resolver/commit/e0ddf63765)] - **travis**: test Node.js v0.8, v1, v2, v3, v4, v5, and v6 (Nathan Rajlich)
* [[`e3c28eedec`](https://github.com/TooTallNate/pac-resolver/commit/e3c28eedec)] - **myIpAddress**: fallback to querying local system for IP (tehdeadone) (#10)
* [[`40de3f9a22`](https://github.com/TooTallNate/pac-resolver/commit/40de3f9a22)] - **package**: require "degenerator" at least v1.0.2 (Nathan Rajlich)
* [[`29009b3c38`](https://github.com/TooTallNate/pac-resolver/commit/29009b3c38)] - **package**: specify any "mocha" v2 (Nathan Rajlich)
* [[`58a3f9e62e`](https://github.com/TooTallNate/node-pac-resolver/commit/58a3f9e62e)] - Implemented `timeRange` function (Utsav Kesharwani) (#15)
* [[`a93a815f0d`](https://github.com/TooTallNate/node-pac-resolver/commit/a93a815f0d)] - Implemented `weekdayRange` function (Utsav Kesharwani) (#14)
* [[`8af3e689eb`](https://github.com/TooTallNate/node-pac-resolver/commit/8af3e689eb)] - **test**: fix typo in test names (Nathan Rajlich)
* [[`e0ddf63765`](https://github.com/TooTallNate/node-pac-resolver/commit/e0ddf63765)] - **travis**: test Node.js v0.8, v1, v2, v3, v4, v5, and v6 (Nathan Rajlich)
* [[`e3c28eedec`](https://github.com/TooTallNate/node-pac-resolver/commit/e3c28eedec)] - **myIpAddress**: fallback to querying local system for IP (tehdeadone) (#10)
* [[`40de3f9a22`](https://github.com/TooTallNate/node-pac-resolver/commit/40de3f9a22)] - **package**: require "degenerator" at least v1.0.2 (Nathan Rajlich)
* [[`29009b3c38`](https://github.com/TooTallNate/node-pac-resolver/commit/29009b3c38)] - **package**: specify any "mocha" v2 (Nathan Rajlich)

@@ -18,0 +31,0 @@ 1.2.6 / 2015-02-21

@@ -0,1 +1,2 @@

'use strict';

@@ -8,2 +9,3 @@ /**

var vm = require('vm');
var parse = require('url').parse;
var thunkify = require('thunkify');

@@ -44,4 +46,5 @@ var degenerator = require('degenerator');

function generate (str, opts) {
function generate (_str, opts) {
var i;
var str = String(_str)

@@ -87,3 +90,3 @@ // the sandbox to use for the vm

// filename of the pac file for the vm
var filename = opts && opts.filename ? opts.filename : 'proxy.pac';
var filename = (opts && opts.filename) || 'proxy.pac';

@@ -97,7 +100,48 @@ // evaluate the JS string and extract the FindProxyForURL generator function

// return the async resolver function
var resolver = co(fn);
var resolver = co.wrap(fn);
return function FindProxyForURL (url, host, fn) {
resolver(url, host, fn);
return function FindProxyForURL (url, _host, _callback) {
let host
let callback
switch (arguments.length) {
case 3:
host = _host
callback = _callback
break;
case 2:
if (typeof _host === 'function') {
callback = _host
} else {
host = _host
}
break;
}
if (!host) {
host = parse(url).hostname;
}
const promise = resolver(url, host, callback);
if (typeof callback === 'function') {
toCallback(promise, callback)
} else {
return promise
}
};
}
function toCallback (promise, callback) {
let called = false
function resolve(rtn) {
if (called) return
called = true
callback(null, rtn)
}
function reject(err) {
if (called) return
called = true
callback(err)
}
promise.then(resolve, reject)
}
{
"name": "pac-resolver",
"version": "2.0.0",
"version": "3.0.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",
"thunkify": "~2.1.1",
"ip": "1.0.1"
"co": "^4.6.0",
"degenerator": "^1.0.4",
"ip": "^1.1.5",
"netmask": "^1.0.6",
"thunkify": "^2.1.2"
},
"devDependencies": {
"mocha": "2"
"mocha": "^3.4.2"
},

@@ -16,0 +16,0 @@ "scripts": {

@@ -43,8 +43,7 @@ pac-resolver

var FindProxyForURL = pac(fs.readFileSync('proxy.pac', 'utf8'));
var FindProxyForURL = pac(fs.readFileSync('proxy.pac'));
FindProxyForURL('http://foo.com/', 'foo.com', function (err, res) {
if (err) throw err;
FindProxyForURL('http://foo.com/').then((res) => {
console.log(res);
// → "DIRECT"
// "DIRECT"
});

@@ -51,0 +50,0 @@ ```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc