Skip to content

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

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

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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy