Skip to content

Commit 330f8d5

Browse files
committedApr 8, 2022
[Robustness] test observably looks up exec on the object
take 2
1 parent b2d547a commit 330f8d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎lib/results.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var resumer = require('resumer');
88
var inspect = require('object-inspect');
99
var callBound = require('call-bind/callBound');
1010
var has = require('has');
11-
var regexpTest = callBound('RegExp.prototype.test');
11+
var $exec = callBound('RegExp.prototype.exec');
1212
var $split = callBound('String.prototype.split');
1313
var $replace = callBound('String.prototype.replace');
1414
var $shift = callBound('Array.prototype.shift');
@@ -226,5 +226,5 @@ function getNextTest(results) {
226226
}
227227

228228
function invalidYaml(str) {
229-
return regexpTest(yamlIndicators, str);
229+
return $exec(yamlIndicators, str) !== null;
230230
}

0 commit comments

Comments
 (0)
Please sign in to comment.