Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 15x 15x 462x 3562x 1x 3561x 26x | import { Duration } from '../types'; import { UNITS } from './units'; export const validate = (duration: Readonly<Duration>): void => { (Object.keys(duration) as (keyof Duration)[]).forEach(unit => { if (!UNITS.includes(unit)) { throw new TypeError(`Unexpected property "${unit}" on Duration object.`); } if (!Number.isInteger(duration[unit])) { throw new TypeError(`Property "${unit}" must be a an integer. Received ${duration[unit]}.`); } }); }; |