Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/mattkingshott/iodine
Browse files Browse the repository at this point in the history
Merge
  • Loading branch information
mattkingshott committed Jul 16, 2021
2 parents 61d9046 + ba6813f commit ea730e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
5 changes: 1 addition & 4 deletions src/iodine.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,7 @@ export class Iodine {
const ruleName = chunks.shift();
let rule = ruleName[0].toUpperCase() + ruleName.slice(1);

let result = this[`is${rule}`].apply(this, [
value,
chunks.join(":"),
]);
let result = this[`is${rule}`].apply(this, [value, chunks.join(":")]);

if (!result) return rules[index];
}
Expand Down
18 changes: 5 additions & 13 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,11 @@ describe("validate values against multiple rules", () => {
).toBe(true);
});

test("parameter that contains semicolon(\":\")", () => {
expect(
Iodine.is(":b", ["required", "regexMatch:^:\\w$"])
).toBe(true);
expect(
Iodine.is("a:b", ["required", "regexMatch:^:\\w$"])
).not.toBe(true);
expect(
Iodine.is(":b", ["required", "regexMatch:^:\\w$"])
).toBe(true);
expect(
Iodine.is("a:b", ["required", "regexMatch:^:\\w$"])
).not.toBe(true);
test('parameter that contains semicolon(":")', () => {
expect(Iodine.is(":b", ["required", "regexMatch:^:\\w$"])).toBe(true);
expect(Iodine.is("a:b", ["required", "regexMatch:^:\\w$"])).not.toBe(true);
expect(Iodine.is(":b", ["required", "regexMatch:^:\\w$"])).toBe(true);
expect(Iodine.is("a:b", ["required", "regexMatch:^:\\w$"])).not.toBe(true);
});
});

Expand Down

0 comments on commit ea730e4

Please sign in to comment.