nickmessing / babel-plugin-jsx-vue-functional

JSX Syntactic Sugar Plugin for Vue Functional Components
MIT License
66 stars 4 forks source link

Add "name" property when in development mode #3

Closed niksy closed 7 years ago

niksy commented 7 years ago

Closes #1.

nickmessing commented 7 years ago

@niksy, looks good but isn't approach of conditional unshifting 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?

niksy commented 7 years ago

@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.

nickmessing commented 7 years ago

@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.

nickmessing commented 7 years ago

@niksy, btw, just released 2.0.0 solving #2, looks like you'll need to rebase

nickmessing commented 7 years ago

Good job