Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
manageIterStack = function (rule) {
if (rule.parent.type !== 'root') {
var parentIterVar = rule.parent.params && list.space(rule.parent.params)[0];
if (iterStack.indexOf(parentIterVar) === -1) {
// If parent isn't in stack, wipe stack
iterStack.splice(0, iterStack.length);
} else {
// If parent is in stack, remove stack after parent
iterStack.splice(iterStack.indexOf(parentIterVar) + 1, iterStack.length - iterStack.indexOf(parentIterVar) - 1);
}
} else {
// If parent (root) isn't in stack, wipe stack
iterStack.splice(0, iterStack.length);
}
// Push current rule on stack regardless
iterStack.push( list.space(rule.params)[0] );
};
if (prop === "font-family") {
decl.value = list
.comma(value)
.map(unquoteFontFamily)
.join(",");
return;
}
let values = list.comma(value);
value = values.map(wringValue.bind(null, preserveHacks, prop)).join(",");
if (re.propertyMultipleValues.test(prop)) {
values = list.space(value);
if (values.length === 4 && values[1] === values[3]) {
values.splice(3, 1);
}
if (values.length === 3 && values[0] === values[2]) {
values.splice(2, 1);
}
if (values.length === 2 && values[0] === values[1]) {
values.splice(1, 1);
}
value = values.join(" ");
}
if (prop === "content") {
return;
}
if (prop === "font-family") {
decl.value = list.comma(value).map(unquoteFontFamily).join(",");
return;
}
values = list.comma(value);
value = values.map(wringValue.bind(null, prop)).join(",");
if (re.propertyMultipleValues.test(prop)) {
values = list.space(value);
if (values.length === 4 && values[1] === values[3]) {
values.splice(3, 1);
}
if (values.length === 3 && values[0] === values[2]) {
values.splice(2, 1);
}
if (values.length === 2 && values[0] === values[1]) {
values.splice(1, 1);
}
value = values.join(" ");
}
list.comma(queryList).forEach(function (query) {
var expressions = {};
list.space(query).forEach(function (expression) {
var feature;
var value;
expression = expression.toLowerCase();
if (expression === "and") {
return;
}
if (/^\w+$/.test(expression)) {
expressions[expression] = true;
return;
}
expression = list.split(expression.replace(/^\(|\)$/g, ""), [":"]);
feature = expression[0];
parentsHaveIterator = function (rule, param) {
if(rule.parent == null) { return false; }
if(rule.parent.type === 'root') { return false; }
if(rule.parent.params == null) { return false; }
var parentIterVar = list.space(rule.parent.params);
if (parentIterVar[0] == null) { return false; }
if (parentIterVar[0] === param) { return true; }
if ( iterStack.indexOf(param) !== -1) { return true; }
return parentsHaveIterator(rule.parent, param);
};
var unquoteFontFamily = function (family) {
var quote;
family = family.replace(re.quotedString, "$2");
quote = setQuote(RegExp.$1);
if (!list.space(family).every(canUnquote)) {
family = quote + family + quote;
}
return family;
};
const unquoteFontFamily = family => {
if (family.match(re.varFunction)) {
return family;
}
let newFamily = family.replace(re.quotedString, "$2");
const quote = setQuote(RegExp.$1);
if (!list.space(newFamily).every(canUnquote)) {
newFamily = `${quote}${newFamily}${quote}`;
}
return newFamily;
};
re.whiteSpacesBeforeSymbol,
"$1"
);
if (atRule.name === "import") {
params = params.replace(
re.urlFunction,
"$1$2"
).replace(
re.quotedString,
quoteImportURL
);
}
if (atRule.name === "namespace") {
params = list.space(
params.replace(re.urlFunction, "$1$2")
).map(quoteNamespaceURL).join("");
}
if (atRule.name === "keyframes") {
params = params.replace(re.quotedString, "$2");
}
if (atRule.name === "supports") {
params = params.replace(re.declInParentheses, wringDeclLike);
}
atRule.params = params;
if (
atRule.params === "" ||
unrollLoop = function (rule) {
var params = list.space(rule.params);
checkParams(rule, params);
var iterator = params[0].slice(1),
index = +params[2],
top = +params[4],
dir = top < index ? -1 : 1,
by = (params[6] || 1) * dir;
var value = {};
for ( var i = index; i * dir <= top * dir; i = i + by ) {
var content = rule.clone();
value[iterator] = i;
vars({ only: value })(content);
if (opts.nested) processLoops(content);
rule.parent.insertBefore(rule, content.nodes);
return;
}
let params = atRule.params
.replace(re.whiteSpaces, " ")
.replace(re.whiteSpacesAfterSymbol, "$1")
.replace(re.whiteSpacesBeforeSymbol, "$1");
if (atRule.name === "import") {
params = params
.replace(re.urlFunction, "$1$2")
.replace(re.quotedString, quoteImportURL);
}
if (atRule.name === "namespace") {
params = list
.space(params.replace(re.urlFunction, "$1$2"))
.map(quoteNamespaceURL)
.join("");
}
if (atRule.name === "keyframes") {
params = params.replace(re.quotedString, "$2");
}
if (atRule.name === "supports") {
params = params.replace(re.declInParentheses, wringDeclLike);
}
atRule.params = params;
if (