Skip to content

Instantly share code, notes, and snippets.

@wspringer
Last active April 18, 2024 07:50
Show Gist options
  • Save wspringer/0d4cab18c5c5af1664745dfddb7d9f8f to your computer and use it in GitHub Desktop.
Save wspringer/0d4cab18c5c5af1664745dfddb7d9f8f to your computer and use it in GitHub Desktop.
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