New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dwolla

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dwolla - npm Package Compare versions

Comparing version 0.0.8 to 0.1.0

75

lib/dwolla.js

@@ -6,20 +6,22 @@ var https = require('https');

function _request(path, params, fn) {
var options = {
host: 'www.dwolla.com'
, path: API_PATH + path
};
if (params) {
options.path += '?' + qs.stringify(params);
}
var req = https.request(options, function(res) {
function resHandler(fn) {
return function (res) {
var data = '';
res.on('data', function(chunk) {
res.on('data', function (chunk) {
data += chunk;
});
res.on('end', function() {
function onEnd() {
res.removeListener('error', onError);
try {
data = JSON.parse(data);
} catch (e) {
fn('Error parsing response from Dwolla API.', data);
var err = new Error('Error parsing response from Dwolla API.');
err.body = data;
err.exception = e;
fn(err);
}

@@ -29,6 +31,30 @@ if (data.Success) {

} else {
fn(data.Message);
var err = new Error(data.Message);
err.body = data
fn(err);
}
});
});
}
function onError(err) {
res.removeListener('end', onEnd)
fn(err)
}
res.once('end', onEnd);
res.once('error', onError);
}
}
function _request(path, params, fn) {
var options = {
host: 'www.dwolla.com'
, path: API_PATH + path
};
if (params) {
options.path += '?' + qs.stringify(params);
}
var req = https.request(options, resHandler(fn));
req.end();

@@ -46,20 +72,3 @@ }

};
var req = https.request(options, function(res) {
var data = '';
res.on('data', function(chunk) {
data += chunk;
});
res.on('end', function() {
try {
data = JSON.parse(data);
} catch (e) {
fn('Error parsing response from Dwolla API.', data);
}
if (data.Success) {
fn(null, data.Response);
} else {
fn(data.Message);
}
});
});
var req = https.request(options, resHandler(fn));
req.write(JSON.stringify(post_data));

@@ -66,0 +75,0 @@ req.end();

@@ -5,3 +5,3 @@ {

"description": "Dwolla API for node.js",
"version": "0.0.8",
"version": "0.1.0",
"repository": {

@@ -13,3 +13,3 @@ "type": "git",

"engines": {
"node": ">=0.4.7 <0.9.0"
"node": ">=0.4.7 <0.10.0"
},

@@ -22,4 +22,4 @@ "dependencies": {},

"scripts": {
"test": "mocha"
"test": "mocha -t 6000"
}
}
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