sindresorhus / dot-prop

Get, set, or delete a property from a nested object using a dot path
MIT License
812 stars 69 forks source link

add possibility to use dot notation with arrays #107

Closed AuthorProxy closed 1 year ago

AuthorProxy commented 1 year ago

is it possible to add dot notation to arrays fields - set\get\has now it works like this: getProperty(obj, 'arr_field[1]') expected: getProperty(obj, 'arr_field.1')

It should work since array is just an object and it's easier to connect code with other libraries

sindresorhus commented 1 year ago

It's an intentional choice. We prefer having one way to do something and the [0] notation is more natural for users.