Files
webstudio/app/shared/props-utils/delete-prop.ts
T

14 lines
413 B
TypeScript

import { type AllUserProps, type DeleteProp } from "@webstudio-is/sdk";
export const deletePropMutable = (
allProps: AllUserProps,
deleteProp: DeleteProp
) => {
const prop = allProps[deleteProp.instanceId];
if (prop === undefined) return false;
const index = prop.props.findIndex(({ id }) => id === deleteProp.propId);
if (index === -1) return false;
prop.props.splice(index, 1);
return true;
};