vevet
Version:
Vevet is a JavaScript library for creative development that simplifies crafting rich interactions like split text animations, carousels, marquees, preloading, and more.
20 lines • 636 B
JavaScript
export function getTextAlignment(node) {
const { direction, textAlign } = getComputedStyle(node);
if (textAlign === 'center') {
return textAlign;
}
if (textAlign === 'justify') {
return direction === 'rtl' ? 'right' : 'left';
}
if (textAlign === 'left' || textAlign === 'right') {
return textAlign;
}
if (textAlign === 'start') {
return direction === 'rtl' ? 'right' : 'left';
}
if (textAlign === 'end') {
return direction === 'rtl' ? 'left' : 'right';
}
return direction === 'rtl' ? 'right' : 'left';
}
//# sourceMappingURL=getTextAlignment.js.map