Closed shockey closed 8 years ago
Amazing! Thanks a lot for contributing this, it's a good feature and I like the implementation!
However, I would like to change one thing.
const packages = []; // data looks like [moduleName, as]
The snippet above seems a bit weird. Instead of having an array where the even entries are module names and the odd entries are the aliases, could we have an map with object instead?
Right now, it would look like this:
packages = ['lodash', '_', 'colors', 'c']
I would like it to be more like this:
packages = {
'lodash': '_',
'colors': 'c'
}
Makes sense?
Hey @VictorBjelkholm,
Actually, that inline comment isn't quite clear- the data in packages
ends up being a nested array, like so:
packages = [ ['lodash', '_'], ['colors', 'c'] ]
That being said, I agree- using an object here is the best way forward. This is what associative arrays are made for! 😃
I'll set that up and push the changes in a bit.
@VictorBjelkholm bump 😃
Sweet! Seems to work fine :) Thanks a lot for adding this feature @kyleshockey! (Also added you as a collaborator in this repo)
Hey all 👋
I saw the discussion in #17 and decided to jump in.
Let's talk about these changes, and hopefully get them merged.
Changes:
flags
andpackages
arrays to make adding more features a little easierreturn
statements added to block-body arrow functions: per MDN, "The block body form doesn't automatically return a value. You need to use an explicit return statement."index.js
, so we can keep track of both what the module's name is and what the user wants to assign it to.hasFlag
andmakeVariableFriendly
functions were added.