Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(result => {
const resultRules = csstree.toPlainObject(csstree.parse(result)).children
const originalRules = csstree.toPlainObject(csstree.parse(originalCss)).children
resultRules.should.have.length.lessThan(originalRules.length)
// not be empty
})
})
const loadGlyphs = (font) => {
const parsedCss = csstree.toPlainObject(csstree.parse(css[font]));
return parsedCss.children.reduce((previous, rule) => {
if (rule.prelude) {
const classSelector = getNodeOfType(rule.prelude, (node) => node.type === 'ClassSelector');
const pseudoClassSelector = getNodeOfType(rule.prelude, (node) => node.type === 'PseudoClassSelector');
if (classSelector && classSelector.name && classSelector.name.indexOf('fa-') === 0 && pseudoClassSelector && pseudoClassSelector.name === 'before') {
const text = getNodeOfType(getNodeOfType(rule.block, (node) => node.type === 'Declaration' && node.property === 'content').value, (node) => node.type === 'String').value;
/* eslint-disable */
return assign(previous, {
[classSelector.name.substring(3)]: eval("'\\u" + text.substring(2, text.length - 1) + "'")
});
/* eslint-enable */
}
}
return previous;
}, {});
};
const stylesheetAstArray = styles.map((style) => {
const ast = parse(style, {
parseValue: false,
parseRulePrelude: false
})
return toPlainObject(ast)
})
response.text().then(text => {
const ast = csstree.parse(text, { parseValue: false })
const obj = csstree.toPlainObject(ast)
stylesheetsContents[url] = obj
})
}
response.text().then((text) => {
const ast = parse(text, {
parseValue: false,
parseRulePrelude: false
})
stylesheetAstObjects[requestUrl] = toPlainObject(ast)
stylesheetContents[requestUrl] = text
})
}
response.text().then((text) => {
const ast = parse(text, {
parseValue: false,
parseRulePrelude: false
});
stylesheetAstObjects[requestUrl] = toPlainObject(ast);
stylesheetContents[requestUrl] = text
})
}
const nodes: (s: string) => Object[] = str =>
R.propOr([], 'children', toPlainObject(parse(str, { context: 'value' })))
styleSheets = styleSheets.map(style => {
const ast = parse(style, {
parseValue: false,
parseRulePrelude: false
})
return toPlainObject(ast)
})
const cleanedStyles = styleSheets.map(ast => {
const stylesheetAstArray = styles.map((style) => {
const ast = parse(style, {
parseValue: false,
parseRulePrelude: false
});
return toPlainObject(ast)
});