Skip to content

Commit

Permalink
Merge pull request #11805 from martndemus/remove-deprecated-enumerabl…
Browse files Browse the repository at this point in the history
…e-aliases

[CLEANUP beta] Remove deprecate anyBy, everyProperty and some of enumerable
  • Loading branch information
rwjblue committed Jul 19, 2015
2 parents 8fa3ffb + 1c621b6 commit 896d667
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 104 deletions.
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;

0 comments on commit 896d667

Please sign in to comment.