@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
27 lines (26 loc) • 850 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.countMatchingKeyValues = void 0;
var referenceObject = {
width: '1px',
height: '1px',
padding: '0',
position: 'absolute',
border: '0',
clip: 'rect(1px, 1px, 1px, 1px)',
overflow: 'hidden',
whiteSpace: 'nowrap'
};
var countMatchingKeyValues = exports.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;
};