object-path icon indicating copy to clipboard operation
object-path copied to clipboard

Different interface for objectPath.insert()?

Open mariocasciaro opened this issue 11 years ago • 1 comments

Instead of:

objectPath.insert(obj, "a.c", "m", 1);

Shouldn't it be:

objectPath.insert(obj, "a.c.1", "m");

To be consistent with the rest of the API?

mariocasciaro avatar Sep 23 '14 11:09 mariocasciaro

it mimicks splice, with a default to zero (splice has no default, it removes the item if the value is not set), if you call it without the 1 at the end, it will work as a unshift, IMHO, this can only happen by having a separated (and not part of the path) parameter

pocesar avatar Sep 23 '14 17:09 pocesar