Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When getting all pages, if the API response is an object, wrap it in an array before pushing it to results. #268

Conversation

jeffstieler
Copy link
Contributor

Fixes #267.

@@ -121,6 +121,10 @@
return cb(err);
}

if (Object.prototype.toString.call(res) === '[object Object]') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason why you haven't used:

if (typeof res === 'object')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I didn't think about it. A better suggestion is:

if (!(res instanceof Array))

@AurelioDeRosa
Copy link
Member

Hi @jeffstieler. Would you mind update your PR?

@jeffstieler
Copy link
Contributor Author

@AurelioDeRosa sorry this slipped through the cracks - updated.

@AurelioDeRosa
Copy link
Member

Merged. Thank you.

@AurelioDeRosa AurelioDeRosa added this to the 0.11.0 milestone Jan 24, 2016
clayreimann added a commit that referenced this pull request May 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants