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 beta] Remove deprecate anyBy, everyProperty and some of enumerable #11805

Merged
merged 1 commit into from Jul 19, 2015
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
59 changes: 0 additions & 59 deletions packages/ember-runtime/lib/mixins/enumerable.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,16 +585,6 @@ export default Mixin.create({
return !this.find((x, idx, i) => !callback.call(target, x, idx, i));
},

/**
@method everyProperty
@param {String} key the property to test
@param {String} [value] optional value to test against.
@deprecated Use `isEvery` instead
@return {Boolean}
@private
*/
everyProperty: aliasMethod('isEvery'),

/**
Returns `true` if the passed property resolves to the value of the second
argument for all items in the enumerable. This method is often simpler/faster
Expand Down Expand Up @@ -669,45 +659,6 @@ export default Mixin.create({
return found;
},

/**
Returns `true` if the passed function returns true for any item in the
enumeration. This corresponds with the `some()` method in JavaScript 1.6.

The callback method you provide should have the following signature (all
parameters are optional):

```javascript
function(item, index, enumerable);
```

- `item` is the current item in the iteration.
- `index` is the current index in the iteration.
- `enumerable` is the enumerable object itself.

It should return the `true` to include the item in the results, `false`
otherwise.

Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context. This is a good way
to give your iterator function access to the current object.

Usage Example:

```javascript
if (people.some(isManager)) {
Paychecks.addBiggerBonus();
}
```

@method some
@param {Function} callback The callback to execute
@param {Object} [target] The target object to use
@return {Boolean} `true` if the passed function returns `true` for any item
@deprecated Use `any` instead
@private
*/
some: aliasMethod('any'),

/**
Returns `true` if the passed property resolves to the value of the second
argument for any item in the enumerable. This method is often simpler/faster
Expand All @@ -724,16 +675,6 @@ export default Mixin.create({
return this.any(iter.apply(this, arguments));
},

/**
@method anyBy
@param {String} key the property to test
@param {String} [value] optional value to test against.
@return {Boolean}
@deprecated Use `isAny` instead
@private
*/
anyBy: aliasMethod('isAny'),

/**
This will combine the values of the enumerator into a single value. It
is a useful way to collect a summary value from an enumeration. This
Expand Down
35 changes: 0 additions & 35 deletions packages/ember-runtime/tests/suites/enumerable/any.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,39 +68,4 @@ suite.test('any should produce correct results even if the matching element is u
});


suite.test('any should be aliased to some', function() {
var obj = this.newObject();
var ary = this.toArray(obj);
var anyFound = [];
var someFound = [];
var cnt = ary.length - 2;
var anyResult, someResult;

anyResult = obj.any(function(i) {
anyFound.push(i);
return false;
});
someResult = obj.some(function(i) {
someFound.push(i);
return false;
});
equal(someResult, anyResult);

anyFound = [];
someFound = [];

cnt = ary.length - 2;
anyResult = obj.any(function(i) {
anyFound.push(i);
return --cnt <= 0;
});
cnt = ary.length - 2;
someResult = obj.some(function(i) {
someFound.push(i);
return --cnt <= 0;
});

equal(someResult, anyResult);
});

export default suite;
5 changes: 0 additions & 5 deletions packages/ember-runtime/tests/suites/enumerable/every.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ suite.test('should return true if every property matches null', function() {
equal(obj.isEvery('bar', null), false, 'isEvery(\'bar\', null)');
});

suite.test('everyProperty should be aliased to isEvery', function() {
var obj = this.newObject();
equal(obj.isEvery, obj.everyProperty);
});

suite.test('should return true if every property is undefined', function() {
var obj = this.newObject([
{ foo: undefined, bar: 'BAZ' },
Expand Down
5 changes: 0 additions & 5 deletions packages/ember-runtime/tests/suites/enumerable/is_any.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,4 @@ suite.test('should not match undefined properties without second argument', func
equal(obj.isAny('foo'), false, 'isAny(\'foo\', undefined)');
});

suite.test('anyBy should be aliased to isAny', function() {
var obj = this.newObject();
equal(obj.isAny, obj.anyBy);
});

export default suite;