UNPKG

@qntm-code/utils

Version:

A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.

14 lines (13 loc) 418 B
import { isJsdom } from '../constants'; import { getComputedStyleAsNumber } from './getComputedStyleAsNumber'; /** * Get the height of an element. * * This helper allows getting of the height when running in a JSDOM environment. */ export function getElementHeight(element) { if (isJsdom) { return getComputedStyleAsNumber(element, 'height'); } return element.getBoundingClientRect().height; }