cast = val =>
    val !== undefined
      ? val.includes(':')
        ? val.split(':').reduce((acc, time) => 60 * acc + +time) * 1000
        : val.endsWith('h')
          ? parseInt(val.slice(0, -1), 10) * 3600000
          : val.endsWith('m')
            ? parseInt(val.slice(0, -1), 10) * 60000
            : val.endsWith('ms')
              ? parseInt(val.slice(0, -2), 10)
              : val.endsWith('s')
                ? parseInt(val.slice(0, -1), 10) * 1000
                : parseInt(val, 10) * 1000
      : val
Parse a duration oriented range
@param {*} spec
@param {*} strictSyntax Whether or not to throw on invalid parts
@example (valid) `1s`, `00:30..`, `..3:40`, `20..1:25`, `1s..=60000ms`, `..=200s`, `2:30..=310000ms`