Commit Graph

421 Commits

Author SHA1 Message Date
Jeremy Ashkenas
110523f9cf Merge pull request #500 from bryanwoods/master
Aliases `_.take()` to `_.first()` and `_.head()`
2012-04-02 12:43:06 -07:00
Jeremy Ashkenas
4620eb7b61 reordering the patch for #504 2012-04-02 15:30:12 -04:00
Jeremy Ashkenas
62114126d9 Merge pull request #504 from mwilliamson/master
Don't call iterable.toArray in _.toArray if not a function
2012-04-02 12:27:38 -07:00
Jeremy Ashkenas
6f5489fcab comment tweak 2012-04-02 15:07:56 -04:00
Jeremy Ashkenas
18ba865009 Merge pull request #524 from octatone/isFinite
New Feature: _.isFinite to compliment _.isNumber and _.isNaN
2012-04-02 12:07:28 -07:00
Jeremy Ashkenas
719cd24aa9 adding an initial implementation of a 'pick' function. #523 2012-04-02 15:01:26 -04:00
Jeremy Ashkenas
4fa0a9f4d5 Merge pull request #523 from chrisleishman/restrict
Add _.restrict(source, *keys)
2012-04-02 11:51:56 -07:00
Jeremy Ashkenas
180b8b0c83 merging #532 -- allow string as iterator on sortBy 2012-04-02 13:46:49 -04:00
Jeremy Ashkenas
d604895018 revisions to #534, sortBy(undefined) 2012-04-02 13:16:58 -04:00
Chris Baynes
e4c4300a06 Allow sortBy to handle undefined values. 2012-03-31 11:05:47 +02:00
Yi, EungJun
6b8a99ba39 Adding the ability to _.sortBy(list, 'property') 2012-03-31 02:28:22 +09:00
Chris Leishman
7c95237845 Add _.restrict(source, *keys)
Return a clone of the source with only the properties named in *keys
(either stings or arrays containing strings).

Especially useful for avoiding mass-assignment vulnerabilities.
2012-03-29 11:54:09 -07:00
Raymond May Jr
ee86820473 use _.isNumber for correctly working check 2012-03-26 13:02:40 -05:00
Brad Dunbar
2c0ccf03ef Documentation for _.template(...).source. 2012-03-26 13:37:06 -04:00
Raymond May Jr
e274235865 _.isFinite fix and tests 2012-03-25 11:08:23 -05:00
Raymond May Jr
705eff4826 add _.isFinite - verifies is a number between Inf && -Inf 2012-03-25 10:43:30 -05:00
Brad Dunbar
2055d745db Attach template source to returned function. 2012-03-23 12:52:50 -04:00
Brad Dunbar
ebb9db4e8e _.result calls property with the correct context. 2012-03-21 06:33:37 -04:00
Raymond May Jr
4c2a85f9c5 size enhancement as ternary and _.size(arr) test case 2012-03-20 09:31:50 -05:00
Raymond May Jr
5827e4a40a _.size ludicrous speed improvement - formatting 2012-03-19 19:10:59 -05:00
Raymond May Jr
2d3edb88f0 _.size ludicrous speed improvement 2012-03-19 19:08:36 -05:00
Brad Dunbar
33be5c62b8 Make a small documentation change. 2012-03-19 15:45:44 -04:00
Brad Dunbar
9a27b1b083 Clarify documentation for _.result. 2012-03-19 15:07:33 -04:00
brad dunbar
a2a35c10ce Merge pull request #512 from braddunbar/getvalue
Add utility function `result`.
2012-03-19 11:46:26 -07:00
Brad Dunbar
5545a3b68d Dispense with abbreviation. 2012-03-19 14:43:20 -04:00
Brad Dunbar
5c7ccb21ef Rename getValue to result. 2012-03-19 14:33:38 -04:00
Brad Dunbar
d0e7b397c1 Cache property value. 2012-03-19 14:24:59 -04:00
Brad Dunbar
666049ac5d Add utility function getValue. 2012-03-17 13:02:17 -04:00
Brad Dunbar
f5eb4b0915 Clean up _.template.
* Cache regexes.
* Use object properties for lookup instead of switch.
2012-03-17 09:26:39 -04:00
Brad Dunbar
826e743262 Handle \u2028 & \u2029 in _.template. 2012-03-12 19:15:18 -04:00
Brad Dunbar
414fafb1f4 Allow natural multi-line code evaluation in templates.
By escaping `\r`, `\n`, and `\t` earlier, we can unescape
them along with backslashes and single quotes allowing
for the inclusion of single line comments and code without
a terminating semicolon.
2012-03-11 12:39:13 -04:00
Michael Williamson
c8ec654e6b Don't call iterable.toArray in _.toArray if not a function 2012-03-10 16:00:23 +00:00
Bryan Woods
b3eb4a5fcb Aliases _.take() to _.first() and _.head() 2012-03-05 12:05:39 -05:00
Kit Cambridge
8808f7d531 Un-golf _.uniq(). 2012-02-21 10:35:55 -07:00
Kit Cambridge
0285f47f78 _.uniq(): Remove unused previous variable. 2012-02-20 12:36:48 -07:00
Kit Cambridge
c8d4025621 Issue #484: _.uniq() should work with sparse arrays. 2012-02-20 12:21:54 -07:00
Derek Brans
c2a58725be Fix for #478 - any and every should be consistent about casting result to boolean 2012-02-16 16:31:18 -05:00
Michael Ficarra
ff544ae997 _.difference should perform a shallow flatten 2012-02-06 12:24:13 -05:00
Jeremy Ashkenas
5533c12033 Fixes #437 -- add an 'immediate' parameter to _.debounce. 2012-01-30 10:53:46 -05:00
Brad Dunbar
5c6abc4453 short circuit isEmpty for null/undefined 2012-01-30 10:15:04 -05:00
Jeremy Ashkenas
3512e7fc5c Fixes #435 -- allows _.max and _.min on arrays of dates without converting them to numbers. 2012-01-24 10:40:20 -05:00
Jeremy Ashkenas
eeea70c457 Underscore 1.3.1 2012-01-23 17:56:29 -05:00
Jeremy Ashkenas
cdf43ea742 Fixes #429 -- don't escape slash escapes in the body of interpolations... 2012-01-23 17:33:48 -05:00
Jeremy Ashkenas
5ed8b6e6ce using a cached reference to hasOwnProperty (again) 2012-01-23 16:05:56 -05:00
Jeremy Ashkenas
f1ecedf64a Merge pull request #440 from arlolra/has
has
2012-01-23 13:03:56 -08:00
Jeremy Ashkenas
f6a1b97426 Merge branch 'master' of github.com:documentcloud/underscore 2012-01-23 15:48:53 -05:00
Jeremy Ashkenas
99c17c4a0d reverting an old change -- _.extend should absolutely copy undefined values. 2012-01-23 15:48:35 -05:00
Arlo Breault
3898597b12 has 2012-01-18 20:34:54 -08:00
Peter Jihoon Kim
978255b778 added "collect" alias for "map" 2012-01-14 00:57:41 +08:00
Jeremy Ashkenas
dd09162b8c Underscore.js 1.3.0 2012-01-11 11:41:14 -05:00