Last active
April 18, 2024 07:50
-
-
Save wspringer/0d4cab18c5c5af1664745dfddb7d9f8f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const numberRegexp = /^[0-9]+$/; | |
export type Validator<T> = (t: T) => boolean | |
export function validZip(s: string) { | |
return s.length === 5 && numberRegexp.test(s); | |
} | |
validZip("09809"); // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment