Skip to content

Commit

Permalink
[Robustness] test observably looks up exec on the object
Browse files Browse the repository at this point in the history
take 2
  • Loading branch information
ljharb committed Apr 8, 2022
1 parent 678b922 commit 4575ca4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/results.js
Expand Up @@ -8,7 +8,7 @@ var resumer = require('resumer');
var inspect = require('object-inspect');
var callBound = require('call-bind/callBound');
var has = require('has');
var regexpTest = callBound('RegExp.prototype.test');
var $exec = callBound('RegExp.prototype.exec');
var yamlIndicators = /:|-|\?/;
var nextTick = typeof setImmediate !== 'undefined' ? setImmediate : process.nextTick;
module.exports = Results;
Expand Down Expand Up @@ -221,5 +221,5 @@ function getNextTest(results) {
}

function invalidYaml(str) {
return regexpTest(yamlIndicators, str);
return $exec(yamlIndicators, str) !== null;
}

0 comments on commit 4575ca4

Please sign in to comment.