@hazae41/glacier
Version:
Yet another React data (re)fetching library
1 lines • 1.73 kB
Source Map (JSON)
{"version":3,"file":"times.cjs","sources":["../../../../../src/mods/fetched/times.ts"],"sourcesContent":["export interface Timed {\n readonly time: number\n}\n\nexport interface TimedInit {\n readonly time?: number\n}\n\nexport interface Cached {\n readonly cooldown?: number\n readonly expiration?: number\n}\n\nexport interface CachedInit {\n readonly cooldown?: number\n readonly expiration?: number\n}\n\nexport namespace Times {\n\n export function min(...times: (Timed & Cached)[]): Timed & Cached {\n const time = Math.min(...times.map(t => t.time))\n\n const cooldownOrInfinity = Math.min(...times.map(t => t.cooldown || Infinity))\n const expirationOrInfinity = Math.min(...times.map(t => t.expiration || Infinity))\n\n const cooldown = cooldownOrInfinity === Infinity ? undefined : cooldownOrInfinity\n const expiration = expirationOrInfinity === Infinity ? undefined : expirationOrInfinity\n\n return { time, cooldown, expiration }\n }\n\n}"],"names":["Times"],"mappings":";;AAkBiBA,uBAchB;AAdD,CAAA,UAAiB,KAAK,EAAA;IAEpB,SAAgB,GAAG,CAAC,GAAG,KAAyB,EAAA;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;QAEhD,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAA;QAC9E,MAAM,oBAAoB,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,IAAI,QAAQ,CAAC,CAAC,CAAA;AAElF,QAAA,MAAM,QAAQ,GAAG,kBAAkB,KAAK,QAAQ,GAAG,SAAS,GAAG,kBAAkB,CAAA;AACjF,QAAA,MAAM,UAAU,GAAG,oBAAoB,KAAK,QAAQ,GAAG,SAAS,GAAG,oBAAoB,CAAA;AAEvF,QAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAA;KACtC;AAVe,IAAA,KAAA,CAAA,GAAG,MAUlB,CAAA;AAEH,CAAC,EAdgBA,aAAK,KAALA,aAAK,GAcrB,EAAA,CAAA,CAAA;;"}