@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
15 lines • 503 B
JavaScript
import { getValueFromShorthand } from './get-value-from-shorthand';
export function getFontSizeValueInScope(cssProperties) {
const fontSizeNode = cssProperties.find(([style]) => {
const [rawProperty, value] = style.split(':');
return /font-size/.test(rawProperty) ? value : null;
});
if (!fontSizeNode) {
return undefined;
}
const [_, fontSizeValue] = fontSizeNode[0].split(':');
if (!fontSizeValue) {
return undefined;
}
return getValueFromShorthand(fontSizeValue)[0];
}