UNPKG

@metamask/snaps-sdk

Version:

A library containing the core functionality for building MetaMask Snaps

28 lines 810 B
/** * Remove undefined props from an object. * * @param props - The object to remove undefined props from. * @returns The object without undefined props. */ function removeUndefinedProps(props) { return Object.fromEntries(Object.entries(props).filter(([, value]) => value !== undefined)); } /** * Create a Snap component from a type. This is a helper function that creates a * Snap component function. * * @param type - The type of the component. * @returns A function that creates a Snap element. * @see SnapComponent */ export function createSnapComponent(type) { return (props) => { const { key = null, ...rest } = props; return { type, props: removeUndefinedProps(rest), key, }; }; } //# sourceMappingURL=component.mjs.map