UNPKG

@empoleon/solid-measure

Version:
28 lines (24 loc) 529 B
import { MeasurementType } from "./get-content-rect"; export interface MeasureProps { client?: boolean; offset?: boolean; scroll?: boolean; bounds?: boolean; margin?: boolean; } const types: MeasurementType[] = [ "client", "offset", "scroll", "bounds", "margin", ]; export default function getTypes(props: MeasureProps): MeasurementType[] { const allowedTypes: MeasurementType[] = []; types.forEach((type) => { if (props[type]) { allowedTypes.push(type); } }); return allowedTypes; }