Commit Graph

178 Commits

Author SHA1 Message Date
Kit Cambridge
a0b3feca85 _.isEqual: Use [[Class]] checking for consistency and performance.
* Objects with different `[[Class]]` names are no longer equivalent.
* String, number, and boolean primitives and their corresponding wrappers (e.g., `"5"` and `new String("5")`) are now equivalent.
* Arrays are now recursively compared by their numeric properties only. All non-numeric properties are ignored.
2011-10-25 22:48:24 -06:00
Jeremy Ashkenas
29f4478a86 Fixing _.throttle() to only execute once if called once. #170 comments. 2011-10-24 16:16:18 -04:00
Jeremy Ashkenas
3c54f79113 fixes #347 2011-10-24 13:19:15 -04:00
Jeremy Ashkenas
b4d9503340 fixes #170, fixes #266 ... reimplementing throttle in terms of debounce. 2011-10-24 13:13:24 -04:00
Jeremy Ashkenas
cfec39fd4e Revert "Fixes #170, #266 ... throttle now starts at the beginning of the call."
This reverts commit bceb77e325.
2011-10-24 12:06:55 -04:00
Jeremy Ashkenas
bceb77e325 Fixes #170, #266 ... throttle now starts at the beginning of the call. 2011-10-24 12:05:59 -04:00
Jeremy Ashkenas
58c88ccc59 Merge branch 'betterIsX' of https://github.com/michaelficarra/underscore 2011-10-24 11:16:04 -04:00
Jeremy Ashkenas
96fdf6fbac Adding the ability to _.groupBy(list, 'account_id') 2011-10-21 14:44:38 -04:00
Jeremy Ashkenas
00cd88cfa6 Enhancing _.bind() to support binding constructors ... which you would never, ever want to do. 2011-10-19 16:51:53 -04:00
Jeremy Ashkenas
4b2de2e107 Fixes #341, flattening arrays in the context of taking a union shouldn't be deep. Adding a shallow parameter to _.flatten() 2011-10-19 15:59:53 -04:00
Jeremy Ashkenas
7fc616943e Issue #329, special check for the common and magical 'length' property. 2011-10-18 23:26:59 -04:00
Jeremy Ashkenas
e79586515c Issue #329 -- significant change to _.isEqual semantics. 2011-10-18 16:07:23 -04:00
Kevin Malakoff
f2a64227fd Reimplemented _.isEqual tests and patch in a fresh branch. 2011-10-06 15:50:51 +02:00
Jeremy Ashkenas
cc6a9d494d Merging in escaping for Underscore templates, using <%- syntax. Sorry Eco. 2011-10-05 16:19:00 -04:00
Jeremy Ashkenas
ac191a28a5 merging in #324 as _.initial 2011-10-05 15:32:34 -04:00
Pier Paolo Ramon
dcda142655 Tests for _.init 2011-10-05 14:14:51 +02:00
Michael Ficarra
221161cecc better isXXX checks; the current tests have too many false positives 2011-10-04 22:24:36 -04:00
Jeremy Ashkenas
348c93515c Issue #272 ... min and max of empty objects. 2011-10-04 17:23:55 -04:00
Jeremy Ashkenas
921b592cd7 Merge pull request #281 from ryantenney/master
Array Shuffle
2011-10-04 14:11:30 -07:00
Jeremy Ashkenas
d79cd48bc5 Merge pull request #285 from malclocke/add_index_argument_to_last
Add an optional index argument to _.last()
2011-10-04 13:06:07 -07:00
Jeremy Ashkenas
7d0e4169a9 shortening module names. 2011-10-04 15:56:32 -04:00
Kit Cambridge
7760e6aa52 Merge git://github.com/documentcloud/underscore into isequal 2011-09-05 17:50:45 -06:00
Kit Cambridge
4fa97eb2fa _.isBoolean should return true for boolean object wrappers. 2011-09-05 15:51:09 -06:00
Kit Cambridge
e9faa40108 Add a comprehensive test suite for isEqual. 2011-09-05 12:27:03 -06:00
Michael Ficarra
bf3aa97c36 reverting some changes to isEqual that were a little too aggressive 2011-09-04 19:34:19 -04:00
Malcolm Locke
e449b00a26 Add guard check to _.last()
Allows _.last() to work as expected with _.map().
2011-09-01 01:10:10 +12:00
Malcolm Locke
a8f0445192 Add an optional index argument to _.last()
This makes _.last() behave the same as _.first().  Passing an optional
second argument n will return the last n elements of the array.
2011-08-31 22:39:05 +12:00
Ryan W Tenney
f4cba513b9 Added function shuffle, with test case. 2011-08-25 21:44:29 +00:00
Jeremy Ashkenas
03b341d063 Merging in #194, adding an iterator to _.uniq 2011-08-03 11:32:31 -04:00
Michael Ficarra
c7c57ca6ff _.isEqual improvements 2011-07-15 18:15:10 -04:00
Kit Goncharov
a12d0035cb _.isEqual: Ensure commutative equality for dates and RegExps. 2011-07-13 14:24:28 -06:00
Jeremy Ashkenas
7eb7b08f71 reverting a non-important change that broke reduceRight in IE. 2011-07-13 12:58:36 -04:00
Kit Goncharov
365eea6aa7 _.isEqual: Streamline the deep comparison algorithm and remove the dependency on _.keys. 2011-07-13 10:48:16 -06:00
Jeremy Ashkenas
779a28d59a Merge branch 'underscore.any' of https://github.com/shinuza/underscore 2011-07-13 12:40:08 -04:00
Jeremy Ashkenas
7573ac7751 Unit tests for sparse arrays. 2011-07-13 12:36:27 -04:00
Jeremy Ashkenas
cd236d4c47 Issue #243. _.functions now also returns the names of function defined in the prototype chain. 2011-07-13 11:09:51 -04:00
Kit Goncharov
cf812e77bc _.isEqual: Ensure that 0 and -0 are not equivalent. NaN values should be equal. 2011-07-12 22:17:12 -06:00
Kit Goncharov
5c2c3ce464 Rewrite _.isEqual and add support for comparing cyclic structures. 2011-07-12 19:42:36 -06:00
Jeremy Ashkenas
0ec859a142 Issue #225, adding _.union, _.difference, to complement _.without and _.intersection. 2011-07-12 16:48:30 -04:00
Florian Friesdorf
9ab3ac44bb move underscore test into a div
more comfortable to include underscore with tests in some other project.
2011-06-25 09:09:55 +02:00
Florian Friesdorf
0202f9f79b make toArray return a clone in case of an array
In combination with backbone this makes coll.toArray() return an array
instead of just returning coll.models, enabling
coll.remove(coll.toArray()) whithout failing half way through.
2011-06-21 18:31:40 +02:00
Jeremy Ashkenas
96dbdaf929 Merge pull request #228 from DmitryBaranovskiy/master
Fixed isEqual and added isObject
2011-06-20 15:50:54 -07:00
Cat Chen
b949d0345f updated _.delay test to use setTimeout to verify _.delay's behavior 2011-06-20 22:30:35 +08:00
Dmitry Baranovskiy
42487bf47d Fixed isEqual if second object has isEqual implemented and added isObject method 2011-06-07 09:48:34 +10:00
shinuza
40af1652eb Modified any/some test case to demonstrate issue #177
Fixed any/some formatting to be consistent with the rest of underscore.js
2011-05-20 09:13:58 +02:00
Jeremy Ashkenas
057da5bc82 Issue #202 ... fallback method for sparse arrays. 2011-05-11 10:27:52 -04:00
shinuza
899000c217 Hashmap keys are not necessarily ordered. groupBy test may fail if the
expected order is not correct.
Fixing this by checking if the keys are present in the hash so
the order is not deterministic.
2011-05-07 12:03:02 +02:00
Andrei
f8a4b78a86 Adding groupBy. 2011-05-05 14:00:40 -04:00
Alfredo Mesen
b9307163b9 Add optional iterator to _.uniq 2011-05-03 21:16:57 -06:00
Jeremy Ashkenas
13d4e626a8 removing obsolete _.after test. 2011-04-15 18:02:51 -04:00