4 ms·
You should check out lodash/underscore [1]. Not only is the codebase well reviewed, but there is a _.pad function in there (left and right!), and the maintainer
by mayank 11y ago
You should check out lodash/underscore [1]. Not only is the codebase well reviewed, but there is a _.pad function in there (left and right!), and the maintainers are open to additions if core functionality is truly missing. You'll also get functional primitives that will actually make JS fun.
[1] https://lodash.com/docs https://lodash.com/docs
Edit: FWIW, lodash also has _.isInteger(), _.range(), and _.inRange().
- shmageggy 11y agoYup I looked there first, but there was no iterator-based range function. lodash/underscore were built for a pre-ES6 world, so they don't cover all the nice iterator/generator stuff that I like from python (yet? hopefully!)
- aumerle 11y agoI suggest you look at using a python like language that transpiles into javascript. For example, https://github.com/kovidgoyal/rapydscript-ng https://github.com/kovidgoyal/rapydscript-ng which supports iterators/generators on both ES 5 and ES 6 runtimes. Using a python like language greatly eases my pain as a primarily python developer that has to code significant amounts of javascript.