UNPKG

typia

Version:

Superfast runtime validators with only one line

5 lines (3 loc) 171 B
export const _isFormatDuration = (str: string): boolean => PATTERN.test(str); const PATTERN = /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/;