zenika-open-source/immutadot

Path syntax: Negative array index

Closed this issue · 6 comments

Description

Slice notation already allows negative indexes.
Allow it in simple array notation as well.

Example

const arr = [1, 2, 3, 4]
add(arr, '[-1]', 1) // => [1, 2, 3, 5]
add(arr, '[-2]', 1) // => [1, 2, 4, 4]

fixed by #291

To be reimplemented in new apply ?

closed by accident while merging dev branch into master...

Maybe wait for #327 ?

You may start 😉

It appears I had already done it when writing the navigators...