export const cached = any>(f: T): (...args: Parameters) => ReturnType => { let called = false; let r: any; return (...args) => { if (!called) { called = true; r = f.apply(null, args); } return r; }; };