Skip to content

Commit

Permalink
[Fix] Apparently in IE 8, RegExp#test is an own property of regexes, …
Browse files Browse the repository at this point in the history
…not a prototype method.
  • Loading branch information
ljharb committed Sep 28, 2015
1 parent 9e568f1 commit e5e1a34
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions es6-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,11 @@

if (Number('0o10') !== 8 || Number('0b10') !== 2) {
var OrigNumber = Number;
var isBinary = Function.bind.call(Function.call, RegExp.prototype.test, /^0b/i);
var isOctal = Function.bind.call(Function.call, RegExp.prototype.test, /^0o/i);
var binaryRegex = /^0b/i;
var octalRegex = /^0o/i;
// Note that in IE 8, RegExp.prototype.test doesn't seem to exist: ie, "test" is an own property of regexes. wtf.
var isBinary = binaryRegex.test.bind(binaryRegex);
var isOctal = octalRegex.test.bind(octalRegex);
var toPrimitive = function (O) { // need to replace this with `es-to-primitive/es6`
var result;
if (typeof O.valueOf === 'function') {
Expand Down

0 comments on commit e5e1a34

Please sign in to comment.