@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
21 lines • 703 B
JavaScript
var referenceObject = {
width: '1px',
height: '1px',
padding: '0',
position: 'absolute',
border: '0',
clip: 'rect(1px, 1px, 1px, 1px)',
overflow: 'hidden',
whiteSpace: 'nowrap'
};
export var countMatchingKeyValues = function countMatchingKeyValues(styleEntries) {
var matchingStyleEntries = styleEntries.filter(function (entry) {
return entry.key in referenceObject;
});
if (styleEntries.length < 5) {
return 0;
}
return matchingStyleEntries.reduce(function (acc, curr) {
return acc + (referenceObject[curr === null || curr === void 0 ? void 0 : curr.key] === (curr === null || curr === void 0 ? void 0 : curr.value) ? 1.5 : 0.75);
}, 0) / styleEntries.length;
};