From 0859b306c9ae35b9d7e73b8e14ec8ceb23662663 Mon Sep 17 00:00:00 2001 From: Jeff Stieler Date: Mon, 28 Dec 2015 23:42:37 -0700 Subject: [PATCH 1/2] If the API response is an object, wrap it in an array before pushing it to results. --- github.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/github.js b/github.js index 2abfc112..101e63d2 100644 --- a/github.js +++ b/github.js @@ -121,6 +121,10 @@ return cb(err); } + if (Object.prototype.toString.call(res) === '[object Object]') { + res = [ res ]; + } + results.push.apply(results, res); var next = (xhr.getResponseHeader('link') || '') From 1b126f257ea12345d064b71a7588b469eb5ba757 Mon Sep 17 00:00:00 2001 From: Jeff Stieler Date: Tue, 19 Jan 2016 22:28:23 -0700 Subject: [PATCH 2/2] Use instanceof instead of toString() to determine if result is a non-Array. --- github.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github.js b/github.js index 101e63d2..32cfb3fc 100644 --- a/github.js +++ b/github.js @@ -121,8 +121,8 @@ return cb(err); } - if (Object.prototype.toString.call(res) === '[object Object]') { - res = [ res ]; + if (!(res instanceof Array)) { + res = [res]; } results.push.apply(results, res);