Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions lib/figo.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ var querystring = require("querystring");
var crypto = require("crypto");

// External dependencies.
var clone = require("clone");
var winston = require("winston");

// Internal modules.
Expand Down Expand Up @@ -785,9 +784,16 @@ var Session = function(access_token) {
// The result parameter is an array of `Security` objects.
//
this.get_securities = function(options, callback) {
options = options == null ? {} : clone(options);
if (typeof options.since !== "undefined")
options.since = typeof options.since === "object" ? options.since.toISOString() : options.since;
if (typeof options === "object" && options !== null) {
try {
options = JSON.parse(JSON.stringify(options));
} catch (e) {
winston.log('warn', 'corrupted `options` object');
options = {};
}
} else {
options = {};
}
options.count = typeof options.count === "undefined" ? 1000 : options.count;
options.offset = typeof options.offset === "undefined" ? 0 : options.offset;
if (typeof options.account_id === "undefined") {
Expand Down Expand Up @@ -847,9 +853,16 @@ var Session = function(access_token) {
// The result parameter is an array of `Transaction` objects, one for each transaction of the user.
//
this.get_transactions = function(options, callback) {
options = options == null ? {} : clone(options);
if (typeof options.since !== "undefined")
options.since = typeof options.since === "object" ? options.since.toISOString() : options.since;
if (typeof options === "object" && options !== null) {
try {
options = JSON.parse(JSON.stringify(options));
} catch (e) {
winston.log('warn', 'corrupted `options` object');
options = {};
}
} else {
options = {};
}
options.count = typeof options.count === "undefined" ? 1000 : options.count;
options.offset = typeof options.offset === "undefined" ? 0 : options.offset;
options.include_pending = options.include_pending ? 1 : 0;
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"node": ">=0.11.0"
},
"dependencies": {
"clone": "^1.0.2",
"winston": "^2.3.0"
}
}