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

isObject returning false on an object #21

Open
mcoakley opened this issue Sep 22, 2016 · 1 comment
Open

isObject returning false on an object #21

mcoakley opened this issue Sep 22, 2016 · 1 comment

Comments

@mcoakley
Copy link
Collaborator

I'm building an app with the Loopback and Angular libraries using a Mongo backend. When the client pulls datasets from the Loopback API there are multiple datasets with an "id" field. So I'm using jinqJs to (a) rename the id field so there isn't a collision and then (b) do a join on two datasets. The objects returned from the Loopback API are being retrieved using Loopbacks Angular service which effectively uses Angulars Resource object - so I have arrays of Resource objects.

When I pull the objects into jinqJs and use a .select() to rename the id field the isObject method returns false for the Resource objects so they aren't mapping correctly.

I changed the isObject code to use:

var type = typeof obj; return obj != null && (type == 'object' || type == 'function')

(Which I took from LoDash .isObject())

And now .isObject returns true as expected.

@fordth
Copy link
Owner

fordth commented Sep 24, 2016

Very cool, thank you. I will take a look and run it through my unit tests about changing the isObject()

mcoakley added a commit to mcoakley/jinqJs that referenced this issue Nov 5, 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

No branches or pull requests

2 participants