Skip to content

Commit 7542bc4

Browse files
committed
[BUGFIX] Ensure ArrayMixin#invoke returns an Ember.A.
This is a partial revert of bee179d, moving back to a manual `forEach` so that we can control the return value a bit more. When prototype extensions are disabled, we cannot rely on `this.map` to return an extended array.
1 parent ad45bd6 commit 7542bc4

File tree

1 file changed

+5
-1
lines changed
  • packages/ember-runtime/lib/mixins

1 file changed

+5
-1
lines changed

packages/ember-runtime/lib/mixins/array.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,11 @@ const ArrayMixin = Mixin.create(Enumerable, {
951951
@public
952952
*/
953953
invoke(methodName, ...args) {
954-
return this.map(item => tryInvoke(item, methodName, args));
954+
let ret = A();
955+
956+
this.forEach(item => ret.push(tryInvoke(item, methodName, args)));
957+
958+
return ret;
955959
},
956960

957961
/**

0 commit comments

Comments
 (0)