Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function applyTransformFeatures (node, opts) {
if (isHex(node)) {
if (opts.colorCase === 'upper') {
node.value = node.value.toUpperCase();
}
if (opts.colorCase === 'lower') {
node.value = node.value.toLowerCase();
}
if (opts.colorShorthand === true) {
node.value = toShorthand(node.value);
}
if (opts.colorShorthand === false) {
node.value = toLonghand(node.value);
}
}
const pair = unit(node.value);
if (pair) {
if (
opts.zeroLengthNoUnit === true &&
~lengths.indexOf(pair.unit.toLowerCase()) &&
Number(pair.number) === 0
) {
node.value = '0';
return;
}
const parts = pair.number.split('.');
let pre = parts[0];
let post = parts.slice(1).join('.');
if (opts.trimLeadingZero === true && parts[1]) {
pre = pre.replace(/^0+/, '');
var isInteger = (function (_ref) {
var type = _ref.type;
var value = _ref.value;
if (type !== 'word') {
return false;
}
var int = unit(value);
return int && !~value.indexOf('.') && !int.unit;
});
export default ({type, value}) => {
if (type !== 'word') {
return false;
}
let int = unit(value);
return int && !~value.indexOf('.') && !int.unit;
};
export default ({type, value}) => {
if (type !== 'word') {
return false;
}
let freq = unit(value);
return freq &&
!endsWith(freq.number, '.') &&
!~freq.unit.indexOf('.') &&
(freq.number === '0' || ~frequencies.indexOf(freq.unit));
};
function isImperceptibleTime(time) {
const parsedTime = valueParser.unit(time)
if (!parsedTime) return false
const absoluteTime = Math.abs(parsedTime.number)
if (parsedTime.unit.toLowerCase() === "ms" && absoluteTime <= MINIMUM_MILLISECONDS) {
return true
}
if (parsedTime.unit.toLowerCase() === "s" && absoluteTime * 1000 <= MINIMUM_MILLISECONDS) {
return true
}
return false
}
function isMultiplier(_ref) {
var type = _ref.type;
var value = _ref.value;
if (type !== 'word') {
return false;
}
var int = unit(value);
return int && !endsWith(int.number, '.') && !~int.unit.indexOf('.') && int.unit === 'x';
};
var isPercentage = (function (_ref) {
var value = _ref.value;
var int = unit(value);
return int && !endsWith(int.number, '.') && !~int.unit.indexOf('.') && int.unit === '%';
});
var isLength = (function (node) {
if (isCalc(node)) {
return true;
}
if (node.type !== 'word') {
return false;
}
var int = unit(node.value);
return int && !endsWith(int.number, '.') && !~int.unit.indexOf('.') && (int.number === '0' || ~lengths.indexOf(int.unit));
});
function isImperceptibleTime(time) {
const parsedTime = valueParser.unit(time)
if (!parsedTime) return false
const absoluteTime = Math.abs(parsedTime.number)
if (parsedTime.unit.toLowerCase() === "ms" && absoluteTime <= MINIMUM_MILLISECONDS) { return true }
if (parsedTime.unit.toLowerCase() === "s" && absoluteTime * 1000 <= MINIMUM_MILLISECONDS) { return true }
return false
}