-
Notifications
You must be signed in to change notification settings - Fork 42
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
#dict is not working with empty arrays #5
Comments
Fixed an issue with empty arrays
Hmm, i agree it's inconsistent. How should we solve it? The idea of dict was to return a jsonpointer/value map. I'm not sure if we should include empty arrays. I think it should be easy to create an object with #dict, process it and apply the values to an other object using #set. If we include empty arrays the result will depend on the order the values are applied. Maybe the best option is to deprecate #has since this can be easily achieved by #get. |
I think that But I agree with you according |
What about non empty arrays and objects? {
arr: [1],
obj: { example: 4 }
} To have a consistent behaviour {
'/arr': [1],
'/arr/0': 1,
'/obj': { example: 4 },
'/obj/example': 4
} In the case above |
I agree with you and although both So my vote for: {
'/arr/0': 1,
'/obj/example': 4
} |
Ok, convinced. I think the iteration functionality should be moved from
(value) ->
type = {}.toString.call(value)
type == '[object Object]' or type == '[object Array]' And What do you think about this changes? |
Nice, waiting for update! |
Any progress on this issue? Actually I'm waiting for the fix or if it is not possible to complete in near future, please merge my pull request, and publish new version in npm. |
@manuelstofer I'm still waiting when you fix this issue and update npm package |
dict doesn't return property if its value is an empty array, but #has checks that it exists.
returns:
The text was updated successfully, but these errors were encountered: