diff --git a/index.html b/index.html index e6a4fe669..633721834 100644 --- a/index.html +++ b/index.html @@ -160,7 +160,7 @@ function. The iterator is bound to the context object, if one is passed. If list is a Javascript object, a pair with key and value properties will be yielded. If the list has an each - method of its own defined, it will be used. Delegates to the native + method of its own, it will be used instead. Delegates to the native forEach function if it exists.
@@ -196,8 +196,8 @@ var sum = _.inject([1, 2, 3], 0, function(memo, num){ return memo + num });
Looks through each value in the list, returning the first one that
passes a truth test (iterator). The function returns as
- soon as it finds the true element, and doesn't continue to traverse
- the list.
+ soon as it finds the first acceptable element, and doesn't continue to
+ traverse the list.
var even = _.detect([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
@@ -257,7 +257,7 @@ _.any([null, 0, 'yes', false]);
include_.include(list, value)
Returns true if the value is present in the list, using
- == to test equality. Uses indexOf internally, if list
+ === to test equality. Uses indexOf internally, if list
is an Array.
@@ -408,7 +408,7 @@ _.flatten([1, [2], [3, [[[4]]]]]);
without_.without(array, [*values])
Returns a copy of the array with all instances of the values
- removed. == is used for the equality test.
+ removed. === is used for the equality test.
_.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
@@ -418,7 +418,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
uniq_.uniq(array, [isSorted])
- Produces a duplicate-free version of the array, using == to test
+ Produces a duplicate-free version of the array, using === to test
object equality. If you know in advance that the array is sorted,
passing true for isSorted will run a much faster algorithm.
@@ -677,7 +677,11 @@ compiled({name : 'moe'});
var list = "<% _.each(people, function(name) { %> <li><%= name %></li> <% }); %>";
_.template(list, {people : ['moe', 'curly', 'larry']});
=> "<li>moe</li><li>curly</li><li>larry</li>"
-
+
+
+
+ Underscore is a DocumentCloud production.
+
diff --git a/underscore.js b/underscore.js
index d70ea072d..22f5b2286 100644
--- a/underscore.js
+++ b/underscore.js
@@ -10,7 +10,7 @@ window._ = {
VERSION : '0.1.0',
// The cornerstone, an each implementation.
- // Handles objects implementing forEach, _each, arrays, and raw objects.
+ // Handles objects implementing forEach, each, arrays, and raw objects.
each : function(obj, iterator, context) {
var index = 0;
try {
@@ -47,7 +47,7 @@ window._ = {
},
// Inject builds up a single result from a list of values. Also known as
- // reduce, and foldl.
+ // reduce, or foldl.
inject : function(obj, memo, iterator, context) {
_.each(obj, function(value, index) {
memo = iterator.call(context, memo, value, index);
@@ -113,12 +113,12 @@ window._ = {
},
// Determine if a given value is included in the array or object,
- // based on '=='.
+ // based on '==='.
include : function(obj, target) {
if (_.isArray(obj)) return _.indexOf(obj, target) != -1;
var found = false;
_.each(obj, function(pair) {
- if (pair.value == target) {
+ if (pair.value === target) {
found = true;
throw '__break__';
}