From 1c621b609a9383a4d8cd4d43df3770165666fef0 Mon Sep 17 00:00:00 2001 From: Marten Schilstra Date: Sat, 18 Jul 2015 18:55:07 +0200 Subject: [PATCH] [CLEANUP beta] Remove deprecate anyBy, everyProperty and some of enumberable --- .../ember-runtime/lib/mixins/enumerable.js | 59 ------------------- .../tests/suites/enumerable/any.js | 35 ----------- .../tests/suites/enumerable/every.js | 5 -- .../tests/suites/enumerable/is_any.js | 5 -- 4 files changed, 104 deletions(-) diff --git a/packages/ember-runtime/lib/mixins/enumerable.js b/packages/ember-runtime/lib/mixins/enumerable.js index be514391f64..358ef6a865f 100644 --- a/packages/ember-runtime/lib/mixins/enumerable.js +++ b/packages/ember-runtime/lib/mixins/enumerable.js @@ -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 @@ -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 @@ -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 diff --git a/packages/ember-runtime/tests/suites/enumerable/any.js b/packages/ember-runtime/tests/suites/enumerable/any.js index 6f6aea23242..5c4e35592d8 100644 --- a/packages/ember-runtime/tests/suites/enumerable/any.js +++ b/packages/ember-runtime/tests/suites/enumerable/any.js @@ -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; diff --git a/packages/ember-runtime/tests/suites/enumerable/every.js b/packages/ember-runtime/tests/suites/enumerable/every.js index 0ff87ee82b7..cf3e2e4396a 100644 --- a/packages/ember-runtime/tests/suites/enumerable/every.js +++ b/packages/ember-runtime/tests/suites/enumerable/every.js @@ -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' }, diff --git a/packages/ember-runtime/tests/suites/enumerable/is_any.js b/packages/ember-runtime/tests/suites/enumerable/is_any.js index f8aafb2e45c..d7f80f32930 100644 --- a/packages/ember-runtime/tests/suites/enumerable/is_any.js +++ b/packages/ember-runtime/tests/suites/enumerable/is_any.js @@ -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;