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

Any plan to support array? #6

Closed
leesei opened this issue Jan 19, 2016 · 3 comments
Closed

Any plan to support array? #6

leesei opened this issue Jan 19, 2016 · 3 comments

Comments

@leesei
Copy link

leesei commented Jan 19, 2016

get-value supports get(obj, 'e[0].f'). See jonschlinkert/get-value#4
But set-value does not create an array given set(obj, 'e[0].f', 'g').
It returns { 'e[0]': { f: 'g' } }.

@jonschlinkert
Copy link
Owner

This would probably be pretty easy to do. I'll add it as a feature request and look into it next time I make changes.

@jonschlinkert
Copy link
Owner

Closing since arrays are already supported. Instead of doing a.[0].b you can just do a.0.b

@jmtoball
Copy link

Just a note: For me it was unexpected that while set-value supports pushing values to existing arrays, the same path will result in an object being created if no array exists yet at the key. I understand the ambiguity here, but the decision to default to array-creation for index keys as 'lodash.set' felt more intuitive to me.

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

3 participants