Closed niksy closed 7 years ago
@niksy, looks good but isn't approach of conditional unshift
ing easier to read?
like:
const a = [1, 2]
condition && a.unshift(0)
?
When I walk through your code the piece that is or is not in array is far from conditional check and you can't read it top-to-bottom which potentially makes it harder to understand IMO. What do you think?
@nickmessing definitely, but I was trying to follow your proposal where name
is second property (although that doesn’t really matter I suppose, since this is only for development purposes). I’ve changed the code a little bit so instead of removing the item from specific index, it inserts it at that index. If you’re still think that mentally this isn’t best approach, I would change to unshift
approach.
@niksy, as you said, it doesn't matter if it's second parameter since browsers don't care about order of keys in object (actually they care with Object.{keys|entries|values}
) but there is no guarantee it's going to be in order of declaration so both unshift
and push
should work fine, I just want the code to be as easy to follow as possible, thank you for your time.
@niksy, btw, just released 2.0.0 solving #2, looks like you'll need to rebase
Good job
Closes #1.