lukeed / dset

A tiny (194B) utility for safely writing deep Object values~!
MIT License
754 stars 22 forks source link

Accept numbers as path elements #12

Closed Andarist closed 3 years ago

Andarist commented 5 years ago

This seems like a reasonable input for me. Both ramda & lodash accept it.

var obj = {}
dset(obj, ['foo', 10, 'baz'], 'bar')

Mentioned libraries also handle this by creating an object instead of array (like in my previously reported issue):

var obj = {}
dset(obj, ['foo', 10.2, 'baz'], 'bar')
lukeed commented 5 years ago

So, basically nothing else treats numbers as indices for array creation?

Andarist commented 5 years ago

Every other lib creates arrays for non-negative integers, no matter if they are represented by numbers or strings On Sun, 9 Sep 2018 at 14:38, Luke Edwards notifications@github.com wrote:

So, basically nothing else treats numbers as indices for array creation?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lukeed/dset/issues/12#issuecomment-419713063, or mute the thread https://github.com/notifications/unsubscribe-auth/AJWMki1HaOI2-biuUB4iAXWJn2rbYWWQks5uZQvPgaJpZM4WgP8j .