Openstatus www.openstatus.dev
at 4c0f4c00a38753a5d0dfd7e7b7b7706dec6f1503 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}