Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLEANUP] Remove Enumerable#contains #15889

Merged
merged 1 commit into from
Nov 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.