mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 11:57:49 +00:00
Aliasing _.contains to _.include
This commit is contained in:
@@ -356,6 +356,7 @@ _.any([null, 0, 'yes', false]);
|
|||||||
|
|
||||||
<p id="include">
|
<p id="include">
|
||||||
<b class="header">include</b><code>_.include(list, value)</code>
|
<b class="header">include</b><code>_.include(list, value)</code>
|
||||||
|
<span class="alias">Alias: <b>contains</b></span>
|
||||||
<br />
|
<br />
|
||||||
Returns <i>true</i> if the <b>value</b> is present in the <b>list</b>, using
|
Returns <i>true</i> if the <b>value</b> is present in the <b>list</b>, using
|
||||||
<i>===</i> to test equality. Uses <b>indexOf</b> internally, if <b>list</b>
|
<i>===</i> to test equality. Uses <b>indexOf</b> internally, if <b>list</b>
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ $(document).ready(function() {
|
|||||||
test('collections: include', function() {
|
test('collections: include', function() {
|
||||||
ok(_.include([1,2,3], 2), 'two is in the array');
|
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([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');
|
ok(_([1,2,3]).include(2), 'OO-style include');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
test("objects: functions", function() {
|
test("objects: functions", function() {
|
||||||
var expected = ["all", "any", "bind", "bindAll", "breakLoop", "clone", "compact",
|
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",
|
"flatten", "foldl", "foldr", "forEach", "functions", "head", "identity", "include",
|
||||||
"indexOf", "inject", "intersect", "invoke", "isArguments", "isArray", "isBoolean", "isDate", "isElement", "isEmpty", "isEqual",
|
"indexOf", "inject", "intersect", "invoke", "isArguments", "isArray", "isBoolean", "isDate", "isElement", "isEmpty", "isEqual",
|
||||||
"isFunction", "isNaN", "isNull", "isNumber", "isRegExp", "isString", "isUndefined", "keys", "last", "lastIndexOf", "map", "max",
|
"isFunction", "isNaN", "isNull", "isNumber", "isRegExp", "isString", "isUndefined", "keys", "last", "lastIndexOf", "map", "max",
|
||||||
|
|||||||
@@ -651,6 +651,7 @@
|
|||||||
_.select = _.filter;
|
_.select = _.filter;
|
||||||
_.all = _.every;
|
_.all = _.every;
|
||||||
_.any = _.some;
|
_.any = _.some;
|
||||||
|
_.contains = _.include;
|
||||||
_.head = _.first;
|
_.head = _.first;
|
||||||
_.tail = _.rest;
|
_.tail = _.rest;
|
||||||
_.methods = _.functions;
|
_.methods = _.functions;
|
||||||
|
|||||||
Reference in New Issue
Block a user