-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from klm-lab/dev
Remove copy, regex, string in favor of custom
- Loading branch information
Showing
21 changed files
with
232 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
export { useInputs, trackInputs } from "./inputs/hook"; | ||
export { required } from "./inputs/validations/required"; | ||
export { number, min, max } from "./inputs/validations/number"; | ||
export { | ||
minLength, | ||
maxLength, | ||
minLengthWithoutSpace, | ||
maxLengthWithoutSpace | ||
} from "./inputs/validations/length"; | ||
export { number, min, max } from "./inputs/validations/length"; | ||
export { email } from "./inputs/validations/email"; | ||
export { regex } from "./inputs/validations/regex"; | ||
export { startsWith, endsWith } from "./inputs/validations/string"; | ||
export { copy } from "./inputs/validations/copy"; | ||
//export { copy } from "./inputs/validations/copy"; | ||
export { match } from "./inputs/validations/match"; | ||
export { asyncCustom } from "./inputs/validations/asyncCustom"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { ValidateInput, ValidationStateType } from "../../types"; | ||
import { validate } from "./index"; | ||
|
||
export const copy = ( | ||
name: string, | ||
omittedRules?: (keyof ValidationStateType)[] | ||
): ValidateInput => { | ||
return ({ i, ok, st, va, omr }) => | ||
validate(st, i!, st.ev[name].k, va, omittedRules ?? omr, ok); | ||
}; | ||
// import { ValidateInput, ValidationStateType } from "../../types"; | ||
// import { validate } from "./index"; | ||
// | ||
// export const copy = ( | ||
// name: string, | ||
// omittedRules?: (keyof ValidationStateType)[] | ||
// ): ValidateInput => { | ||
// return ({ i, ok, st, va, omr }) => | ||
// validate(st, i, st.ev[name].k, va, omittedRules ?? omr, ok); | ||
// }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Unknown, ValidateInput } from "../../types"; | ||
|
||
export const email = (em?: Unknown): ValidateInput => { | ||
export const email = (errorMessage: Unknown): ValidateInput => { | ||
return ({ va }) => | ||
/^(([^<>()\]\\.,;:\s@"]+(\.[^<>()\]\\.,;:\s@"]+)*)|(".+"))@(([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test( | ||
va?.toLowerCase() | ||
) | ||
? null | ||
: em; | ||
? "" | ||
: errorMessage; | ||
}; |
Oops, something went wrong.