Closed eddiemonge closed 9 years ago
Hmm, could we come up with a better name than format
?
Hmm, could we come up with a better name than format?
Yes please. I couldn't think of one and did not like format either
As I commented on that PR, something like that doesn't belong in this module. You should rather use filter-obj
.
saving an additional loop after this.
Extreme premature optimization.
its not really premature in this instance. with this change, it only requires a map loop through 3000 object once instead of at least twice.
That's exactly the definition of premature optimization. 3000 iterations is negligible.
I wonder though, instead of having the description
option, what if we had a new method called npmKeyword.name()
that only returned an array of names. That way all this would be moot. Thoughts?
I feel like adding that would internally do the same exact thing as this PR but be less flexible. As a compromise I suppose it could be acceptable.
I feel like adding that would internally do the same exact thing as this PR but be less flexible.
I prefer designing minimalistic interfaces that solve actual problems than prematurely designing for everything. Different mindset I guess.
@eddiemonge Alright. Upgrade to 3.0.0: https://github.com/sindresorhus/npm-keyword#npmkeywordnameskeyword-callback ;)
Allows the returned array members to use a custom format. Good for returning an array of strings or different output saving an additional loop after this. (like in https://github.com/yeoman/yeoman-generator-list/pull/23/files#diff-7e051b4df176cc4ddd6101faa1cfd585R22)