Skip to content

Commit f99f96d

Browse files
committed
rename variable, use includes instead of indexOf
1 parent b61540e commit f99f96d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

schemas/ajv.absolutePath.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ module.exports = ajv =>
2424
compile(expected, schema) {
2525
function callback(data) {
2626
let passes = true;
27-
const isExclamationMarkPresent = data.indexOf("!") !== -1;
28-
const isAbsolutePath = expected === /^(?:[A-Za-z]:\\|\/)/.test(data);
27+
const isExclamationMarkPresent = data.includes("!");
28+
const isCorrectAbsoluteOrRelativePath =
29+
expected === /^(?:[A-Za-z]:\\|\/)/.test(data);
2930

3031
if (isExclamationMarkPresent) {
3132
callback.errors = [
@@ -40,7 +41,7 @@ module.exports = ajv =>
4041
passes = false;
4142
}
4243

43-
if (!isAbsolutePath) {
44+
if (!isCorrectAbsoluteOrRelativePath) {
4445
callback.errors = [getErrorFor(expected, data, schema)];
4546
passes = false;
4647
}

0 commit comments

Comments
 (0)