Skip to content

Commit

Permalink
rename variable, use includes instead of indexOf
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Mar 18, 2018
1 parent b61540e commit f99f96d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions schemas/ajv.absolutePath.js
Expand Up @@ -24,8 +24,9 @@ module.exports = ajv =>
compile(expected, schema) {
function callback(data) {
let passes = true;
const isExclamationMarkPresent = data.indexOf("!") !== -1;
const isAbsolutePath = expected === /^(?:[A-Za-z]:\\|\/)/.test(data);
const isExclamationMarkPresent = data.includes("!");
const isCorrectAbsoluteOrRelativePath =
expected === /^(?:[A-Za-z]:\\|\/)/.test(data);

if (isExclamationMarkPresent) {
callback.errors = [
Expand All @@ -40,7 +41,7 @@ module.exports = ajv =>
passes = false;
}

if (!isAbsolutePath) {
if (!isCorrectAbsoluteOrRelativePath) {
callback.errors = [getErrorFor(expected, data, schema)];
passes = false;
}
Expand Down

0 comments on commit f99f96d

Please sign in to comment.