underscore
underscore copied to clipboard
JavaScript's utility _ belt
Rounding out my PRs for today: An alternative implementation of https://github.com/jashkenas/underscore/pull/2099, using a Map shim. [Performs](http://jsperf.com/underscore-uniq-hash-table-lookup/7) just as well, but simplifies `_.uniq` instead of making it more complex. This also...
For the record, I like `_.mapObject` better. But this change was undiscussed. Re: https://github.com/jashkenas/underscore/issues/2061, 4f771e0
Stolen from lodash, used to determine if one of our underscore methods were called by `_.each`, `_.map`, or friends.
I suggest adding a new function called oneArg to underscore. It wraps a function and allows it to be called with one argument only and ignores rest of the arguments....
I am noticing some strange behavior when running _.isEmpty on an empty jQuery object. At first, _.isEmpty returns false, but if I add an empty collection to it the collection,...
Continuing the [discussion](https://github.com/jashkenas/underscore/commit/bdb06bcfcdcc85bfe3b494d9907762945f7d7c49#commitcomment-13243061), at the moment: ``` js _.size('💕') // => 2 ``` Since `str.length` is trivial I think it --may-- be handy if `_.size` returned the number of symbols...
Methods like `_.sample`, `_.first`, `_.initial`, `_.last`, & `_.rest` have guards to support being used as an iteratee for methods like `_.map`. I think it'd be great if this was expanded...
Thoughts on making the Underscore wrapper an iterator and iterable? It would require detecting `Symbol.iterator` and doing something like ``` js _.prototype[Symbol.iterator] = function() { return this; }; _.prototype.next =...
I think support for converting iterators to arrays would be a nice to have for `_.toArray`.