MCPcopy Index your code
hub / github.com/ether/etherpad / parseWindow

Function parseWindow

src/node/updater/MaintenanceWindow.ts:48–58  ·  view source on GitHub ↗
(raw: unknown)

Source from the content-addressed store, hash-verified

46 * callers should treat that as "tier 4 disabled, fall back to tier 3".
47 */
48export const parseWindow = (raw: unknown): MaintenanceWindow | null => {
49 if (!raw || typeof raw !== 'object') return null;
50 const r = raw as Record<string, unknown>;
51 if (typeof r.start !== 'string' || typeof r.end !== 'string') return null;
52 if (r.tz !== 'local' && r.tz !== 'utc') return null;
53 const s = toMinutes(r.start);
54 const e = toMinutes(r.end);
55 if (s == null || e == null) return null;
56 if (s === e) return null;
57 return {start: r.start, end: r.end, tz: r.tz};
58};
59
60const wallMinutes = (now: Date, tz: MaintenanceWindow['tz']): number => (
61 tz === 'utc'

Callers 5

performCheckFunction · 0.90
schedulerTriggerApplyFunction · 0.90
evaluatePolicyFunction · 0.90
expressCreateServerFunction · 0.90

Calls 1

toMinutesFunction · 0.85

Tested by

no test coverage detected