(units)
| 111182 | ]; |
| 111183 | const UNITS = TIME_UNITS.reduce((o, u, i)=>(o[u] = 1 + i, o), {}); |
| 111184 | function timeUnits(units) { |
| 111185 | const u = (0, _vegaUtil.array)(units).slice(), m = {}; // check validity |
| 111186 | if (!u.length) (0, _vegaUtil.error)("Missing time unit."); |
| 111187 | u.forEach((unit)=>{ |
| 111188 | if ((0, _vegaUtil.hasOwnProperty)(UNITS, unit)) m[unit] = 1; |
| 111189 | else (0, _vegaUtil.error)("Invalid time unit: ".concat(unit, ".")); |
| 111190 | }); |
| 111191 | const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0); |
| 111192 | if (numTypes > 1) (0, _vegaUtil.error)("Incompatible time units: ".concat(units)); |
| 111193 | // ensure proper sort order |
| 111194 | u.sort((a, b)=>UNITS[a] - UNITS[b]); |
| 111195 | return u; |
| 111196 | } |
| 111197 | const defaultSpecifiers = { |
| 111198 | [YEAR]: "%Y ", |
| 111199 | [QUARTER]: "Q%q ", |
no test coverage detected