Commit Graph

101 Commits

Author SHA1 Message Date
Jeremy Ashkenas
6b8bb0cacd Better Underscore isType checking, in the presence of Internet Explorer host objects, which are a bit touchy. 2010-12-01 10:25:55 -05:00
Jeremy Ashkenas
00237103fc removing an errant a. 2010-12-01 09:49:45 -05:00
Jeremy Ashkenas
9e3e067f50 Initial draft of _.throttle and _.debounce 2010-11-30 11:41:48 -05:00
Jason Davies
47eb154ccf Preserve backslashes in _.template()
For example, templates containing things like the literal string
`\ribbit` weren't being escaped properly when being compiled. The `\r`
was being interpreted as a carriage return character.

I've added a test for this too, and all the existing tests pass.
2010-11-09 22:59:03 +00:00
Jeremy Ashkenas
a08c3dbd6b Merge branch 'fix_reduceRight_initial_value' of http://github.com/mcmire/underscore 2010-11-01 08:42:19 -04:00
Elliot Winkler
f729769d85 Fix reduceRight() so that if you don't pass in an initial value, the last item in the collection is used 2010-10-31 19:03:52 -06:00
Elliot Winkler
c21e7b24c6 Fix reduce() so that if you don't pass in an initial value, the first item in the collection is used 2010-10-31 18:51:30 -06:00
Jeremy Ashkenas
8fe19f2023 Underscore 1.1.2 2010-10-15 17:21:41 -04:00
Jeremy Ashkenas
74d282ccc8 fixing mistakenly-aliased contains ... should refer to include. 2010-10-15 17:15:26 -04:00
Jeremy Ashkenas
5b4b308c91 Fixing template settings 2010-10-07 10:44:49 -04:00
Ryan W Tenney
81ce3ee0bd Updated templateSettings regexes in tests, replacing the . with [\s\S] 2010-10-05 22:34:24 -04:00
Ryan W Tenney
2de76e065e Escaped lts, gts and amps in the test case descriptions. 2010-10-05 22:33:16 -04:00
Jeremy Ashkenas
faa672ecd9 Underscore 1.1.1 2010-10-05 17:52:36 -04:00
Jeremy Ashkenas
348147d8fb better default multiline-aware templates 2010-10-05 17:10:44 -04:00
Jeremy Ashkenas
5984be70c1 adding m flag to default templateSettings regexes. 2010-10-05 17:05:03 -04:00
Jeremy Ashkenas
3ce6f9a93b Merge branch 'ultra-mega-important-fix' of http://github.com/maw/underscore 2010-09-28 09:55:02 -04:00
Jeremy Ashkenas
fbd682d9ec Fixing Issue #35. newlines in evaluated code. 2010-09-27 17:35:43 -04:00
Jeremy Ashkenas
902f1192e0 fixing test that tried to load nonexistent images in a template. 2010-09-27 15:45:08 -04:00
Samuel Clay
4c35fc80dc Cleaning up testcase's variable names for readability. 2010-09-23 12:37:42 -04:00
Samuel Clay
2068f0819d Fixing _.template() bug where using 'p' as a variable name would override the variable by the same name in _.template(), causing an error. See test case utilities.namespaceCollisionTemplate() for example of broken case. 2010-09-23 12:35:25 -04:00
Michael Wolf
83c7a006cb fix tyop 2010-09-09 18:20:08 -05:00
Jeremy Ashkenas
b2b5a5390b merging a variant of svieira's fix for preserving whitespace within templates. 2010-07-20 13:37:27 -04:00
Jeremy Ashkenas
ef396a9e13 Aliasing _.contains to _.include 2010-07-15 10:18:11 -04:00
Jeremy Ashkenas
9827f87611 (breaking change) moving _.reduce's method signature to that of ECMA5. _.reduce(obj, iterator, memo). Updated tests and docs. 2010-07-15 09:50:55 -04:00
Nick Stenning
e81a2ec516 Allow _.template functions to be called with no arguments.
This change simply allows templates to be called with no arguments, for a behaviour equivalent to being called with an empty object, {}.
2010-07-14 11:09:05 +01:00
Jeremy Ashkenas
29e2c832bc Underscore 1.0.4, with _.memoize 2010-06-22 09:21:03 -04:00
Ryan W Tenney
0e8ca3cb97 NaN is never equal to NaN. Fixed in underscore.js and underscore-min.js, updated tests in test/objects.js 2010-06-12 17:10:48 -04:00
Jeremy Ashkenas
79f65b440a Even though it's not really part of the API, making _.isEmpty work with Strings cross-browser. 2010-04-06 13:01:45 -04:00
Jeremy Ashkenas
a6578068d2 Underscore 1.0.1 -- bugfix release for _.isEqual 2010-03-19 10:07:21 -04:00
Mike Frawley
4085b68be4 enhance #extend to allow taking multiple source objects.
This is done in jquery, extjs, and others as well.

added tests, no docs
2010-03-05 15:24:59 -05:00
Jeremy Ashkenas
9903905175 merging mrjjwright's isBoolean, with tests, docs, and credit 2010-02-27 00:03:36 -05:00
John Wright
bd271e4794 added _.isBoolean function 2010-02-26 21:46:58 -07:00
Jeremy Ashkenas
d855def438 adding an _.mixin utility function that allows you to add functions to Underscore (also used internally) 2010-02-24 13:44:46 -05:00
Jeremy Ashkenas
d7acbca2ce reverted _.buildLookup, restoring _.without to it's previous implementation, adding a test for object identity 2010-02-24 12:53:35 -05:00
Jeremy Ashkenas
7824d63ce8 make the new faster isEmpty a little safer too 2010-02-24 12:43:57 -05:00
Jeremy Ashkenas
2ec05e758b merging ratbeard/closure 2010-02-24 11:45:05 -05:00
Jeremy Ashkenas
a2aab7c699 merging ratbeard's numerous improvements 2010-02-24 11:38:27 -05:00
Rick Fletcher
38a82591b1 Added failing test for quotes in statements with regex-significant characters in tokens 2010-02-23 23:44:25 -08:00
Rick Fletcher
625adb81a3 Added tests for templates with regex-significant characters in their delimiters 2010-02-23 23:41:51 -08:00
Mike Frawley
59d383c151 Revert "Create #alias method, callable on any object, _ by default."
This reverts commit c43de549ba.

Conflicts:

	test/objects.js
2010-02-23 17:26:32 -06:00
Mike Frawley
5a5e14d7a4 add #times utility method.
_(3).times(alert)

added tests and internal docs
2010-02-17 10:21:59 -06:00
Mike Frawley
263b1ee92d add #buildLookup method to turn collection in to a fast lookup hash
implement #without in terms of it
add tests and internal docs
2010-02-17 10:12:22 -06:00
Mike Frawley
130e860ecf improve #isEmpty implementation. add 2 tests 2010-02-17 09:48:29 -06:00
Mike Frawley
c43de549ba Create #alias method, callable on any object, _ by default.
While I'm not a fan of making abstractions where a simpe solution
exists, I think this is good as it makes a public API for extending
underscore, therefore making it "ok" to make your own alias names.

Also give us some future proofing in case we ever add in hooks on
method definition. For example, right now if you add a method
or make an alias in user code, it isn't added to the wrapper prototype.

Added tests and inline docs, no external docs
2010-02-17 09:41:18 -06:00
Jeremy Ashkenas
11e7af06e9 close that iframe document after writing to it 2010-02-08 07:12:40 -05:00
Jeremy Ashkenas
d01bb56833 adding type tests across iframes for all isType functions 2010-02-05 08:22:40 -05:00
Jeremy Ashkenas
5b5ee87c7a Underscore 0.5.8, with collection functions that once again work on NodeLists and HTMLCollections 2010-01-28 00:55:41 -05:00
Jeremy Ashkenas
30858c50a8 added suggested speed boost for isNumber 2010-01-20 13:50:08 -05:00
Jeremy Ashkenas
7ec091cc55 safer isArguments function -- make sure we're not dealing with strings or functions 2010-01-20 12:45:32 -05:00
Jeremy Ashkenas
7d9e603be8 Underscore 0.5.6, with custom template delimiters 2010-01-18 12:45:04 -05:00