Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
Commits on Apr 18, 2012
@jashkenas Fixes #522 -- document the arguments to the iterator in reduce 74f4545
@jashkenas Fixes #554 -- documents arguments to defer bc8266d
@braddunbar braddunbar Fix #556 - interpolate coerces null/undefined to ''. b24be55
@jashkenas Merge pull request #560 from braddunbar/interpolate-null
Fix #556 - interpolate coerces null/undefined to ''.
Commits on Apr 19, 2012
@colinta colinta more tests, and using __t trick in `_.escape` 4c4203d
@kevinoid kevinoid Tighten specification for _.sortedIndex
sortedIndex should specify that it returns the lowest index at which an
item may be inserted to maintain sorted order, rather than any index
which satisfies this property, in order to provide easier use
maintaining a sorted list of unique elements.

For example, with the previous specification, the following behavior is

_.sortedIndex([10, 20, 30, 40], 30)
=> 3

To accommodate this behavior users would have to check both array[si]
and array[si-1] (when si > 0) before inserting to ensure uniqueness, or
to examine the underscore.js implementation and rely on the
implementation not changing.

Note:  This specification change does not require any changes to the

Signed-off-by: Kevin Locke <>
@kevinoid kevinoid Add test for tightened sortedIndex specification
Test that the lowest index, rather than any index, at which the element
should be inserted to maintain sorted order is returned.

Signed-off-by: Kevin Locke <>
@jashkenas Merge pull request #562 from colinta/master
One last addition...
@jashkenas Merge pull request #563 from kevinoid/sorted-index-spec
Tighten specification for _.sortedIndex
@jashkenas comments and style tweaks 7d29339
@jashkenas Merge branch 'master' of 6ba2c5d
Commits on Apr 21, 2012
@bmaland bmaland Add _.exclude(object, *keys)
Return a copy of the object, filtered to exclude the blacklisted keys (or array
of valid keys).

Similar to _.pick, but using blacklisting instead of whitelisting which can be
more appropriate in some cases.
Commits on Apr 22, 2012
@roryokane roryokane in sortedIndex test, rename variables to prevent confusion
I was confused when I read the second part of the test. The variable name was index2, and "30 should be inserted at index 2". But then I looked a few lines up, and saw that index's number "should be inserted at index 3". I had thought that the '2' at the end of 'index2' meant something it didn't. This renaming prevents that confusion.

This change highlights the repetition in this test. It is possible that a good next step would be to refactor the testing of these two numbers into an each loop. Or perhaps that would make the test unnecessarily complicated. I am not confident enough to make that call, so I'll leave it as it is.
Commits on Apr 23, 2012
@shama shama typo fixes 320b67a
@braddunbar braddunbar Merge pull request #567 from shama/patch-typo
A few typo fixes
@jashkenas Merge pull request #566 from roryokane/patch-1
in sortedIndex test, rename variables to prevent confusion
Commits on Apr 26, 2012
@spadgos spadgos The 'needle' value is cached in sortedIndex ca0f211
@braddunbar braddunbar Merge pull request #571 from spadgos/sorted-index-caching
Cache iterator(obj) in sortedIndex
@braddunbar braddunbar Use a separate variable for the iterator result value. e3fa7a6
Commits on Apr 27, 2012
@mhansen mhansen A linear algorithm for _.flatten.
Massive speedups on _.flatten for large, deep arrays.
Commits on Apr 28, 2012
@pepkin88 pepkin88 Adding ", [context]" to the definition of `_.times()`. d55cb4b
@braddunbar braddunbar Merge pull request #574 from pepkin88/patch-2
Adding ", [context]" to the definition of `_.times()`.
Commits on Apr 29, 2012
@int3 int3 Make _.throttle reentrant. 6e5d5b8
Commits on Apr 30, 2012
@int3 int3 Make immediate-debounce reentrant. e74241b
@jashkenas Merge pull request #576 from int3/throttle
Make throttle reentrant
@jashkenas Merge pull request #573 from mhansen/master
A linear algorithm for _.flatten.
@jashkenas edited implementation of _.flatten e813db6
Commits on May 01, 2012
@gsamokovarov gsamokovarov Small whitespace cleanup for _.times and an anonymous function defini…
@jashkenas Merge pull request #582 from gsamokovarov/patch-1
Whitespace cleanup for _.times and an anonymous function definition
Commits on May 04, 2012
@braddunbar braddunbar Style change, remove unnecessary semicolon. 9bc5078
@jashkenas Merge pull request #588 from braddunbar/template-style
Style change, remove unnecessary semicolon.
Commits on May 05, 2012
@braddunbar braddunbar Update QUnit. 5831005
@jashkenas Merge pull request #590 from braddunbar/qunit
Update QUnit.
Commits on May 09, 2012
@jashkenas Fixes #578 -- allow max() and min() to be called on very large arrays…
…, and still be optimized on smaller ones.
@jashkenas Merge branch 'master' of c22db85
Commits on May 10, 2012
@jashkenas adding a rel=canonical 4b0b3a5
Commits on May 14, 2012
@jashkenas adding docs about isObject a4414ce
Commits on May 21, 2012
@hswolff hswolff Implement mobile-site for underscore 80532fd
Commits on May 22, 2012
@jashkenas Merge pull request #610 from hswolff/mobile-site
Implement mobile-site for underscore
@jashkenas initial draft of removing sparse array workarounds. 4e4bc19
@jashkenas space removal typo. 74f86a6
@jashkenas removing over-indentation. 658f921
@jashkenas removing longstanding broken test. 5b515ef
@jashkenas alignment and variable name f6a6aca
@jashkenas breaking out the HTML escaping regex for a single pass. fceac7a
@jashkenas elaborating comment. b3a5632
@jashkenas removing the deprecated 'intersect' name for _.intersection dc1a2b0
Commits on May 23, 2012
@jashkenas removing broken noConflict test 70d54d0
@jashkenas Fixes #603. Adds an _.zipObject() function. f66f20b
@jashkenas removing old AMD-removal warning. 1ece112
@jashkenas adding a warning about (lack of) sparse array support 36bb762
@jashkenas removing needless isSorted optimization. 47e7dbb
@jashkenas adding parens for clarity 94f10d8
@jashkenas hoisting out the flatten function. 0da7b39
Commits on May 24, 2012
@jashkenas Fixes #613: Adding a link to the chinese version of the docs. 4ebb87c
@jashkenas elongating a single-line if. 7ef6b6d
Commits on May 25, 2012
@michaelficarra michaelficarra Add tests for `_.find`. e162a68
Commits on May 26, 2012
@michaelficarra michaelficarra corrections to tests for `_.find` as requested by @braddunbar 6eb19ac
@braddunbar braddunbar Merge pull request #617 from michaelficarra/patch-3
Add tests for `_.find`.
@braddunbar braddunbar Remove unnecessary code as per #618. 03a8b0b
@braddunbar braddunbar Merge pull request #619 from braddunbar/invoke
Remove unnecessary code as per #618.
Commits on May 31, 2012
@robb robb Adding a link to Underscore.m in the docs
It's an Objective-C port of Underscore.js
Commits on Jun 08, 2012
@jashkenas Fixes #633 -- allow _.shuffle to work on Objects as well as Arrays 6b196fd
@jashkenas Merge branch 'master' of 89fa3e6
@jashkenas Merge pull request #623 from robb/master
Add a link to Underscore.m in docs
Commits on Jun 10, 2012
@jashkenas removing extra parameters from callback. 91a841a
Commits on Jun 14, 2012
@braddunbar braddunbar Fix #642 - Update jQuery. 6ab42d2
@braddunbar braddunbar Update references to deprecated `_.intersect`. dc624f4
Commits on Jun 15, 2012
@braddunbar braddunbar QUnit 1.8.0 322a641
Commits on Jun 20, 2012
@russplaysguitar russplaysguitar Added info and links to Underscore.cfc to docs 7c63003
Commits on Jun 21, 2012
@brettgoulder brettgoulder Just do the media query for the iPhone 4 f066c79
@jashkenas Merge pull request #647 from brettgoulder/master
Just do the media query on the docs for the iPhone 4, not retina macbook pro
@jashkenas Merge pull request #646 from russplaysguitar/master
Added Underscore.cfc info to docs
Commits on Jun 26, 2012
Mike Sidorov Simplify some isType methods declaration d76acef
@jashkenas Merge pull request #654 from FarSeeing/master
Simplify some isType methods declaration
Commits on Jun 28, 2012
@lennym lennym Added default every/all iterator as _.identity for consistency with a…
@braddunbar braddunbar Reference in the README. bde1eea
Commits on Jul 12, 2012
@braddunbar braddunbar Fix #670 - Use `value` rather than `variable`. c8178e5
@jashkenas Merge pull request #671 from braddunbar/isundefined
Fix #670 - Use `value` rather than `variable`.
Commits on Jul 18, 2012
@jashkenas Adding an _.countBy. 53c67e7
@jashkenas Merge branch 'master' of f6f9d37
Commits on Aug 03, 2012
@jashkenas adding underscore objective-c ports 2eb8d2d
Commits on Aug 07, 2012
@subzey subzey Unreference wrapped function in _.once
Assuming we'll never run the wrapped function again on _.once(), we can
assign null to the `func` variable, so function (and all its inherited
scopes) may be collected by GC if needed.
Commits on Aug 13, 2012
Tim Walling update doc to reflect that times passes index to iterator 4f66975
@jashkenas Merge pull request #701 from twalling/master
update doc to reflect that times passes index to iterator
Commits on Aug 15, 2012
@jashkenas clearer 'variable' example for _.template, plus passive voice exorcism. 3032ea2
@jashkenas Merge branch 'master' of f2cca69
Commits on Aug 18, 2012
@braddunbar braddunbar Tweak _.toArray.
* Combine _.isArray and _.isArguments type checks.
* _.isFunction will suffice for obj.toArray.
@braddunbar braddunbar Document `take` alias. 78652c6
Commits on Aug 20, 2012
@jashkenas Merge pull request #707 from braddunbar/take
Document `take` alias.
@jashkenas Merge pull request #706 from braddunbar/toarray
Tweak _.toArray.
Commits on Aug 24, 2012
@braddunbar braddunbar Merge #565 from @bmaland. 272f4c6
@braddunbar braddunbar Rename _.exclude as _.omit and tweak a bit. 98b548d
@braddunbar braddunbar Fix #715 - `omit` includes prototype properties. f603a3d
@jashkenas Merge pull request #716 from braddunbar/omit-proto-props
Fix #715 - `omit` includes prototype properties.
@jashkenas Fixes #717 -- refactor pick and omit... b73b025
Commits on Aug 25, 2012
@braddunbar braddunbar _.omit uses _.include instead of delete. 625ebe1
@braddunbar braddunbar Merge pull request #719 from braddunbar/omit-include
_.omit uses _.include instead of delete.
Commits on Aug 27, 2012
@taiju taiju added "drop" alias for "rest" 8912960
Commits on Aug 30, 2012
@jashkenas Adding an _.pairs function. 3ee2fb1
@jashkenas Merge branch 'master' of 399d8a0
@jashkenas Changed _.zipObject to _.object, now able to handle both key and valu…
…e lists, as well as a list of tuples. Works as the inverse of _.pairs
@jashkenas Merge pull request #720 from taiju/add-alias-drop
added "drop" alias for "rest"
@jashkenas Fixes #653, _.size(arguments) a087797
@jashkenas Merge branch 'master' of 881e529
@jashkenas Fixes #702 -- allow _.escape to return empty strings for null and und…
@jashkenas test for previous commit 811794f
@jashkenas Fixes #700 -- in reverse. talk less about strict equality. f654312
@jashkenas removing old temp-tests file 411f434
@jashkenas Fixes #698 (not really) -- adds a test for arrays of undefined. 1118772
@braddunbar braddunbar Document `drop` alias. 879acb4
@jashkenas Merge pull request #726 from braddunbar/drop-alias
Document `drop` alias.
@jashkenas Merge pull request #693 from subzey/master
Unreference wrapped function in _.once
@jashkenas Fixes #689 -- adding an _.random 9642623
Commits on Aug 31, 2012
Michael Aufreiter Fixed link to Data.js. 575304f
@braddunbar braddunbar Merge pull request #727 from michael/prose-patch
Fixed link to Data.js.
@braddunbar braddunbar Tweak whitespace. a76eb37
@jashkenas correcting implementaion of _.random c2cef3d
@jashkenas Fixes #676 -- adds an _.unescape as the inverse of _.escape ... and a…
…lso adds an _.invert for inverting objects.
@jashkenas Fixes #666: Adds a 'template' property to the error, whenever you hav…
…e a SyntaxError in a _.template
@jashkenas removing old temp.js file a4a2e03
@jashkenas adding a test for #666 b24a1c2
@jashkenas Revert "adding a test for #666"
This reverts commit b24a1c2.
@jashkenas Revert "Fixes #666: Adds a 'template' property to the error, whenever…
… you have a SyntaxError in a _.template"

This reverts commit 4e6b147.
@jashkenas Fixes #666: adds generated source to syntaxerrors of templates 2b1d7bd
@jashkenas Merge pull request #661 from lennym/patch-1
Added default every/all iterator as _.identity for consistency with any/some
@jashkenas Fixes #650 -- have size simply use a numeric length property, if one …
…is available.
@jashkenas Fixes #635: document that _.times passes the iteration count 2ebe669
Commits on Sep 02, 2012
@braddunbar braddunbar Upgrade QUnit. f25cfc4
@braddunbar braddunbar test/{test.html -> index.html} 3a4fc1e
@braddunbar braddunbar Fix #746 - template settings are not modified. b1eae9a
@braddunbar braddunbar Fix #750 - Refactor wrapper. 6587a30
Commits on Sep 04, 2012
@jashkenas Merge pull request #754 from braddunbar/template-settings
Fix #746 - template settings are not modified.
@jashkenas Merge pull request #752 from braddunbar/test-index
test/{test.html -> index.html}
@jashkenas Merge pull request #751 from braddunbar/wrapper-refactor
Fix #750 - Refactor wrapper.
Commits on Sep 05, 2012
@braddunbar braddunbar Drop doubled test prefixes. 50efe43
@jashkenas Merge pull request #759 from braddunbar/test-prefix
Drop doubled test prefixes.
Commits on Sep 06, 2012
@albertsun albertsun Improvement for #465 -- update the return value from throttle when ca…
…lled repeatedly
@jashkenas Merge pull request #762 from albertsun/master
Update the return value of a throttled function
Commits on Sep 10, 2012
@jashkenas Fixes #767 -- comparison of circular reference with non-circular refe…
Commits on Sep 11, 2012
@jashkenas Changing Underscore's _.each semantics to whitelist for arrays and ar…
…guments, instead of a numeric length propery.
Commits on Sep 12, 2012
@jashkenas Tweaking / cleaning implementation of _.uniq. 8f8e988
@jashkenas Fixes #764 -- Removing extra sparse array checks from the heart of is…
@jashkenas Fixes #760 -- clarify chaining docs b6375d7
@jashkenas Fixes #769 -- update function count. 12d493e
@jashkenas Fixes #757 -- move sortedIndex to Arrays category 1ee60e4
@jashkenas Fixes #755 -- be more consistent in internal use of _.flatten over pr…
…ivate recursive flatten function.
@jashkenas Fixes #755 -- use concat.apply for shallow flattening internally. 4880a43
@jashkenas Fixes #749 -- isNaN returns true for wrapped NaN objects. 6ebb43f
@jashkenas Fixes #748 -- removes support for custom isEqual semantics within _.i…
@jashkenas Fixes #770 -- allow _.size to continue to repsect numeric 'length' ..…
…. mainly for the benefit of jQuery array-likes.
@jashkenas Fixes #770 -- reverts each array-like semantics change. d4ebe55
Commits on Sep 14, 2012
@ryanve ryanve optimize _.mixin and _.wrap ef48bd6
@braddunbar braddunbar Merge pull request #774 from ryanve/master
optimize _.mixin and _.wrap
@jashkenas Adding an 'Edge Version' link to the homepage 68ce78a
@jashkenas Merge branch 'master' of 2339573
@jashkenas Fixes #771 -- removes custom toArray support and adds array-like supp…
@jashkenas Fixes #740 -- debounced functions now return their last updated value cb8aff2
@jashkenas Fixes #738 -- makes sortBy a stable sort. aea79c1
Commits on Sep 17, 2012
@jashkenas revising #738 -- implementation of stable sortBy a8087f0
@jashkenas trying out the new CONTRIBUTING feature d09457f
@jashkenas tweaks to CONTRIBUTING 233b8db
Commits on Sep 18, 2012
@braddunbar braddunbar Clean up groupBy/countBy/sortBy.
* Remove superfluous argument to `lookupIterator`.
* Add context argument to `groupBy`, `countBy`.
* Streamline `sortBy`.
@jashkenas Merge pull request #780 from braddunbar/cleanup
Clean up groupBy/countBy/sortBy.
@jashkenas Fixes #648 -- adds to Underscore. 5fd4f4e
@jashkenas Merge branch 'master' of 7f8161e
@jashkenas Fixes #689 -- allow _.random() to be called with just a max, and use …
…it in _.shuffle
@jashkenas Fixes #725 -- wording in the documentation of sortedIndex. 1f90ca2
Commits on Sep 19, 2012
@braddunbar braddunbar Fix #779 - Delimiters are used without escaping. bb4ec45
@braddunbar braddunbar Use `slice` instead of non-standard `substr`. ed83596
@jashkenas Merge pull request #782 from braddunbar/delimiters
Fix #779 - Delimiters are used without escaping.
@jashkenas Fixes #729 -- reduceRight passes correct arguments for non-arrays. d7fdfa7
@jashkenas Fixes #733 -- quick-fix implementation of isEqual on naked objects fr…
…om different frames.
@jashkenas #729 -- implementing reduceRight for object iteration e769848
Commits on Sep 20, 2012
@jashkenas Fixes #783 -- implement reduceRight with an internal flag. 24a58fe
@jashkenas optimizing toFunction 64c45f1
@braddunbar braddunbar Reverse isFunction check. 680c46b
@jashkenas Fixes #743 -- avoid treating object functions like collection functions. cf0de25
@jashkenas Fixes #772 -- elevate the official underscore method as 'contains' in…
…stead of 'include'
@jashkenas Prefer _.contains to _.include internally. 684fd56
@jashkenas Fixes #756 -- switch to uglifier (passes tests) c8142f5
@jashkenas Revert "Fixes #756 -- switch to uglifier (passes tests)"
This reverts commit c8142f5.
@jashkenas Revert "Revert "Fixes #756 -- switch to uglifier (passes tests)""
This reverts commit 7943cd1.
@jashkenas Fixes #734 -- meaningless hypothetical non-tweak to isElement ;) ab31329
@jashkenas #735 -- allows sortedIndex to work on extremely large arrays. e852e01
@jashkenas Fixes #737 -- adds fromIndex to _.indexOf and _.lastIndexOf c66c71c
@jashkenas Fixes #736 -- allow groupBy and countBy to work with dynamic keys tha…
…t are the same as Object.prototype properties.
@jashkenas Fixes #739 -- uniq and sortedIndex now accept contexts to go along wi…
…th their iterators.
Commits on Sep 21, 2012
@aeosynth aeosynth chmod -x favicon 391bccd
@jashkenas Merge pull request #791 from aeosynth/master
chmod -x favicon
@jashkenas #783 -- adjusted reduceRight implementation. 5097178
@jashkenas Merge branch 'master' of 12495cf
Commits on Sep 24, 2012
@braddunbar braddunbar _.sortedIndex takes a string as an iterator. 7c0a45f
@braddunbar braddunbar Fix #792 - Correct docs for _.defaults. 6eec024
Commits on Sep 26, 2012
@jashkenas Merge pull request #797 from braddunbar/defaults
Fix #792 - Correct docs for _.defaults.
@jashkenas Merge pull request #796 from braddunbar/sorted-index-iterator
_.sortedIndex takes a string as an iterator.
Commits on Sep 27, 2012
@braddunbar braddunbar Fix #798 - Pass collection to groupBy/countBy iterator. a1ea2fb
@jashkenas Merge pull request #800 from braddunbar/iterator-args
Fix #798 - Pass collection to groupBy/countBy iterator.
@jashkenas Fixes #744, reverts #80. Removes special null handling from collectio…
…n and array functions.
@jashkenas Underscore.js 1.4.0 37609e8