diff --git a/index.html b/index.html index 4cbad8700..a39074357 100644 --- a/index.html +++ b/index.html @@ -356,6 +356,7 @@ _.any([null, 0, 'yes', false]);
include_.include(list, value)
+ Alias: contains
Returns true if the value is present in the list, using
=== to test equality. Uses indexOf internally, if list
diff --git a/test/collections.js b/test/collections.js
index eb449d690..9c72e889e 100644
--- a/test/collections.js
+++ b/test/collections.js
@@ -111,7 +111,7 @@ $(document).ready(function() {
test('collections: include', function() {
ok(_.include([1,2,3], 2), 'two is in the array');
ok(!_.include([1,3,9], 2), 'two is not in the array');
- ok(_.include({moe:1, larry:3, curly:9}, 3), '_.include on objects checks their values');
+ ok(_.contains({moe:1, larry:3, curly:9}, 3), '_.include on objects checks their values');
ok(_([1,2,3]).include(2), 'OO-style include');
});
diff --git a/test/objects.js b/test/objects.js
index 7dadb8476..fc9c93d42 100644
--- a/test/objects.js
+++ b/test/objects.js
@@ -12,7 +12,7 @@ $(document).ready(function() {
test("objects: functions", function() {
var expected = ["all", "any", "bind", "bindAll", "breakLoop", "clone", "compact",
- "compose","defer", "delay", "detect", "each", "every", "extend", "filter", "first",
+ "compose", "contains", "defer", "delay", "detect", "each", "every", "extend", "filter", "first",
"flatten", "foldl", "foldr", "forEach", "functions", "head", "identity", "include",
"indexOf", "inject", "intersect", "invoke", "isArguments", "isArray", "isBoolean", "isDate", "isElement", "isEmpty", "isEqual",
"isFunction", "isNaN", "isNull", "isNumber", "isRegExp", "isString", "isUndefined", "keys", "last", "lastIndexOf", "map", "max",
diff --git a/underscore.js b/underscore.js
index a7274adea..5d45d8536 100644
--- a/underscore.js
+++ b/underscore.js
@@ -651,6 +651,7 @@
_.select = _.filter;
_.all = _.every;
_.any = _.some;
+ _.contains = _.include;
_.head = _.first;
_.tail = _.rest;
_.methods = _.functions;