Openstatus www.openstatus.dev
at 0580c562a6f62100a34f50c6aa910ff8fdb7d519 18 lines 401 B view raw
1export function parseInputToProps( 2 json: unknown, 3 eventProps?: string[], 4): Record<string, unknown> { 5 if (typeof json !== "object" || json === null) return {}; 6 7 if (!eventProps) return {}; 8 9 return eventProps.reduce( 10 (acc, prop) => { 11 if (prop in json) { 12 acc[prop] = json[prop as keyof typeof json]; 13 } 14 return acc; 15 }, 16 {} as Record<string, unknown>, 17 ); 18}