Skip to content

Commit

Permalink
[Robustness] call-bind Array.prototype.join
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Oct 12, 2020
1 parent c01b2d0 commit b81dcfa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions es6-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
var _strSlice = Function.call.bind(String.prototype.slice);
var _push = Function.call.bind(Array.prototype.push);
var _pushApply = Function.apply.bind(Array.prototype.push);
var _join = Function.call.bind(Array.prototype.join);
var _shift = Function.call.bind(Array.prototype.shift);
var _max = Math.max;
var _min = Math.min;
Expand Down Expand Up @@ -741,7 +742,7 @@
_push(result, String.fromCharCode((next % 0x400) + 0xDC00));
}
}
return result.join('');
return _join(result, '');
},

raw: function raw(template) {
Expand Down Expand Up @@ -769,7 +770,7 @@
_push(stringElements, nextSub);
nextIndex += 1;
}
return stringElements.join('');
return _join(stringElements, '');
}
};
if (String.raw && String.raw({ raw: { 0: 'x', 1: 'y', length: 2 } }) !== 'xy') {
Expand Down

0 comments on commit b81dcfa

Please sign in to comment.