Commit Graph

241 Commits

Author SHA1 Message Date
Brad Dunbar
89c50e1a95 Allow _.templateSettings to be overriden. 2012-04-03 17:38:39 -07:00
Brad Dunbar
b04b813f02 Add varname to _.templateSettings.
* Leave out the with statement when using varname.
* Rename source to compiled.
* Comments, comments, comments.
2012-04-03 11:51:57 -07:00
Jeremy Ashkenas
8cfb076c9b removing added speed test 2012-04-03 11:49:31 -04:00
Jakub Wieczorek
a40001a358 Remove the unnecessary branch in _.shuffle()
The non-zero case works properly for 0 as well.
2012-04-03 15:26:39 +02:00
Jeremy Ashkenas
73e6e87858 Fixes #465 -- throttled functions return their value when they actually run. 2012-04-02 16:32:53 -04:00
Jeremy Ashkenas
b52908f78f Fixes #491 - IE9 / Opera 11 test case. 2012-04-02 15:50:31 -04:00
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
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
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
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
4266d91805 test _.isFinite against new Number 2012-03-26 13:00:25 -05:00
Raymond May Jr
bf6cb03519 test against NaN 2012-03-25 14:10:35 -05:00
Raymond May Jr
55b68fdaba formatting 2012-03-25 11:20:57 -05:00
Raymond May Jr
e274235865 _.isFinite fix and tests 2012-03-25 11:08:23 -05:00
Mark Rushakoff
85672298d9 Prefer equal(x, y) over ok(x == y) 2012-03-22 19:21:23 -07: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
Brad Dunbar
5c7ccb21ef Rename getValue to result. 2012-03-19 14:33:38 -04:00
Brad Dunbar
666049ac5d Add utility function getValue. 2012-03-17 13:02:17 -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
c8d4025621 Issue #484: _.uniq() should work with sparse arrays. 2012-02-20 12:21:54 -07:00
Derek Brans
7c7c38decf Test: any and every cast result to boolean. Relates to #478 2012-02-17 11:40:47 -05:00
Jeremy Ashkenas
5533c12033 Fixes #437 -- add an 'immediate' parameter to _.debounce. 2012-01-30 10:53:46 -05:00
Brad Dunbar
458e604eee upgrade qunit 2012-01-30 10:31:12 -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
cdf43ea742 Fixes #429 -- don't escape slash escapes in the body of interpolations... 2012-01-23 17:33:48 -05: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
Peter Jihoon Kim
978255b778 added "collect" alias for "map" 2012-01-14 00:57:41 +08:00
Jeremy Ashkenas
69ed6177ab Fixes #411. Partially adding _.templateSettings could break template strings containing the words 'null' or 'undefined'. 2012-01-04 16:00:36 -05:00
Jeremy Ashkenas
62c814d9fe Fixes #408: _.chain(object) as well as _(object).chain() 2011-12-30 15:07:22 -05:00
fredericksgary
2206092e25 Use _.isFunction so ClojureScript doesn't break underscore
Clojurescript adds a call method to strings, so passing a string to
_.invoke produces the wrong behavior.
2011-12-22 14:38:34 -05:00
Bob Remeika
5ca27ffed1 Fixes #409 - Unexpected arguments passed to wrapper function in _.wrap when the first argument of calling the wrapper function is an array 2011-12-20 01:51:51 -08:00
Jeremy Ashkenas
b4a38439ce Merge pull request #401 from Stuk/template_js_fix
Fix escaped chars in Javascript in templates
2011-12-16 10:09:48 -08:00
Jeremy Ashkenas
3c5686f784 Fixes #403 2011-12-16 12:41:20 -05:00
Stuart Knightley
81cb0d3a86 Add failing test for Javascript in templates
Uses an escaped character in Javascript embedded in a template. Gets
incorrectly replaced when templating.
2011-12-08 11:33:31 -08:00
Jeremy Ashkenas
813bb57bf0 Underscore.js 1.2.3 2011-12-07 10:12:08 -05:00
Jeremy Ashkenas
770f0876b3 re-adding 649f62 2011-12-07 09:35:07 -05:00
Jeremy Ashkenas
9e41927293 rolling back to the previous implementation of 'each' ... cancels out #385 2011-12-06 17:33:43 -05:00
John-David Dalton
2c5661ebb3 underscore: Avoid regression and cleanup comments. [jddalton] 2011-12-06 01:16:56 -05:00
John-David Dalton
d8d1bd0259 Merge https://github.com/documentcloud/underscore into unittests 2011-12-06 01:04:29 -05:00
John-David Dalton
649f629bb1 underscore: Allow _.reduce and _.reduceRight to have an explicitly undefined value. [jddalton] 2011-12-03 22:24:53 -05:00