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')
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.