Sha256: 5a03e1102b7195f2b893a0d0887c15c72b2c900c08b969831a0bfa9c4d1bd2d5
Contents?: true
Size: 1.1 KB
Versions: 202
Compression:
Stored size: 1.1 KB
Contents
const { scaleMinimum = 2, lowerBound = false } = options || {}; const content = node.getAttribute('content') || ''; if (!content) { return true; } const result = content.split(/[;,]/).reduce((out, item) => { const contentValue = item.trim(); if (!contentValue) { return out; } const [key, value] = contentValue.split('='); if (!key || !value) { return out; } const curatedKey = key.toLowerCase().trim(); let curatedValue = value.toLowerCase().trim(); // convert `yes` to `1` if (curatedKey === 'maximum-scale' && curatedValue === 'yes') { curatedValue = 1; } // when negative ignore key if (curatedKey === 'maximum-scale' && parseFloat(curatedValue) < 0) { return out; } out[curatedKey] = curatedValue; return out; }, {}); if ( lowerBound && result['maximum-scale'] && parseFloat(result['maximum-scale']) < lowerBound ) { return true; } if (!lowerBound && result['user-scalable'] === 'no') { this.data('user-scalable=no'); return false; } if ( result['maximum-scale'] && parseFloat(result['maximum-scale']) < scaleMinimum ) { this.data('maximum-scale'); return false; } return true;
Version data entries
202 entries across 202 versions & 1 rubygems