Skip to content

Commit

Permalink
Merge pull request #15889 from cibernox/remove-enumerable-contains
Browse files Browse the repository at this point in the history
[CLEANUP] Remove Enumerable#contains
  • Loading branch information
rwjblue authored Nov 30, 2017
2 parents 62761c5 + 0f2eb90 commit c27cd04
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 55 deletions.
30 changes: 0 additions & 30 deletions packages/ember-runtime/lib/mixins/enumerable.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,36 +207,6 @@ const Enumerable = Mixin.create({
return last;
}).readOnly(),

/**
Returns `true` if the passed object can be found in the receiver. The
default version will iterate through the enumerable until the object
is found. You may want to override this with a more efficient version.
```javascript
let arr = ['a', 'b', 'c'];
arr.contains('a'); // true
arr.contains('z'); // false
```
@method contains
@deprecated Use `Enumerable#includes` instead. See https://emberjs.com/deprecations/v2.x#toc_enumerable-contains
@param {Object} obj The object to search for.
@return {Boolean} `true` if object is found in enumerable.
@public
*/
contains(obj) {
deprecate(
'`Enumerable#contains` is deprecated, use `Enumerable#includes` instead.',
false,
{ id: 'ember-runtime.enumerable-contains', until: '3.0.0', url: 'https://emberjs.com/deprecations/v2.x#toc_enumerable-contains' }
);

let found = this.find(item => item === obj);

return found !== undefined;
},

/**
Iterates through the enumerable, calling the passed function on each
item. This method corresponds to the `forEach()` method defined in
Expand Down
2 changes: 0 additions & 2 deletions packages/ember-runtime/tests/suites/enumerable.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ const EnumerableTests = Suite.extend({
import anyTests from './enumerable/any';
import isAnyTests from './enumerable/is_any';
import compactTests from './enumerable/compact';
import containsTests from './enumerable/contains';
import includesTests from './enumerable/includes';
import everyTests from './enumerable/every';
import filterTests from './enumerable/filter';
Expand All @@ -302,7 +301,6 @@ import withoutTests from './enumerable/without';
EnumerableTests.importModuleTests(anyTests);
EnumerableTests.importModuleTests(isAnyTests);
EnumerableTests.importModuleTests(compactTests);
EnumerableTests.importModuleTests(containsTests);
EnumerableTests.importModuleTests(everyTests);
EnumerableTests.importModuleTests(filterTests);
EnumerableTests.importModuleTests(findTests);
Expand Down
23 changes: 0 additions & 23 deletions packages/ember-runtime/tests/suites/enumerable/contains.js

This file was deleted.

0 comments on commit c27cd04

Please sign in to comment.