UNPKG

@atlaskit/eslint-plugin-design-system

Version:

The essential plugin for use with the Atlassian Design System.

24 lines 905 B
import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; import { getValueFromShorthand } from './get-value-from-shorthand'; export function getFontSizeValueInScope(cssProperties) { var fontSizeNode = cssProperties.find(function (_ref) { var _ref2 = _slicedToArray(_ref, 1), style = _ref2[0]; var _style$split = style.split(':'), _style$split2 = _slicedToArray(_style$split, 2), rawProperty = _style$split2[0], value = _style$split2[1]; return /font-size/.test(rawProperty) ? value : null; }); if (!fontSizeNode) { return undefined; } var _fontSizeNode$0$split = fontSizeNode[0].split(':'), _fontSizeNode$0$split2 = _slicedToArray(_fontSizeNode$0$split, 2), _ = _fontSizeNode$0$split2[0], fontSizeValue = _fontSizeNode$0$split2[1]; if (!fontSizeValue) { return undefined; } return getValueFromShorthand(fontSizeValue)[0]; }