4 ms·
Not that I agree with micro modules (I would rather see a set of js core libs), but your code fails with empty strings.
by JD557 11y ago
Not that I agree with micro modules (I would rather see a set of js core libs), but your code fails with empty strings.
- dagw 11y agoThat code fails in a whole host of cases, kind of proving that sometimes trivial "just one line" functions aren't actual that trivial to get right. edit: fortunately there's an npm modules you can included to fix it...
- bewo001 11y agoMaybe F1axs knows that at this particular spot the string will never be empty? There are two philosophies in libraries; one is to check for every possible error in the lib function, the other is to state the pre-conditions in the documentation.
- nailer 11y ago> Not that I agree with micro modules (I would rather see a set of js core libs) Why not both? If you just want one part of a module, you can just import the dependency directly, if you want a whole core lib, you can do that. Some people really like underscore and import that. I use ES6/7 functions for the most part, but underscore has some useful things I can import on their own.