Skip to content

Commit

Permalink
Merge pull request #9320 from stefanpenner/remove-wastefull-call
Browse files Browse the repository at this point in the history
[Bugfix beta] if the obj already has the method, don’t bother using call
  • Loading branch information
rwjblue committed Oct 15, 2014
2 parents fd0c1bf + 23c8ef8 commit fbf91df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/ember-metal/lib/enumerable_utils.js
Expand Up @@ -28,7 +28,7 @@ var splice = Array.prototype.splice;
* @return {Array} An array of mapped values.
*/
export function map(obj, callback, thisArg) {
return obj.map ? obj.map.call(obj, callback, thisArg) : _map.call(obj, callback, thisArg);
return obj.map ? obj.map(callback, thisArg) : _map.call(obj, callback, thisArg);
}

/**
Expand All @@ -42,7 +42,7 @@ export function map(obj, callback, thisArg) {
*
*/
export function forEach(obj, callback, thisArg) {
return obj.forEach ? obj.forEach.call(obj, callback, thisArg) : a_forEach.call(obj, callback, thisArg);
return obj.forEach ? obj.forEach(callback, thisArg) : a_forEach.call(obj, callback, thisArg);
}

/**
Expand All @@ -58,7 +58,7 @@ export function forEach(obj, callback, thisArg) {
* @since 1.4.0
*/
export function filter(obj, callback, thisArg) {
return obj.filter ? obj.filter.call(obj, callback, thisArg) : _filter.call(obj, callback, thisArg);
return obj.filter ? obj.filter(callback, thisArg) : _filter.call(obj, callback, thisArg);
}

/**
Expand All @@ -72,7 +72,7 @@ export function filter(obj, callback, thisArg) {
*
*/
export function indexOf(obj, element, index) {
return obj.indexOf ? obj.indexOf.call(obj, element, index) : _indexOf.call(obj, element, index);
return obj.indexOf ? obj.indexOf(element, index) : _indexOf.call(obj, element, index);
}

/**
Expand Down

0 comments on commit fbf91df

Please sign in to comment.