Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function check(decl, size) {
// Parse the size and walk through Numerics
parse(size, {
ignoreUnknownWords: true
}).walkNumerics(({ value, unit: valueUnit }) => {
// Return early if not a checked unit
if (!lengthUnits.includes(valueUnit)) return;
// Validate scale and units
const validUnit = unit ? valueUnit === unit : true;
const validScale = scale.includes(Math.abs(Number(value)));
// Get message of the violation
let message;
if (!validScale) {
message = messages.expected(`${value}`, scale.join(", "));
} else if (!validUnit) {
message = messages.expected(`${valueUnit}`, `${unit}`);
} else {
function check(decl, size) {
// Parse the size and walk through Numerics
parse(size, {
ignoreUnknownWords: true
}).walkNumerics(({ value, unit: valueUnit }) => {
// Return early if not a checked unit
if (!lengthUnits.includes(valueUnit)) return;
// Validate scale and units
const validUnit = unit ? valueUnit === unit : true;
const validScale = scale.includes(Number(value));
// Get message of the violation
let message;
if (!validScale) {
message = messages.expected(`${value}`, scale.join(", "));
} else if (!validUnit) {
message = messages.expected(`${valueUnit}`, `${unit}`);
} else {
function check(decl, size) {
// Parse the size and walk through Numerics
parse(size, {
ignoreUnknownWords: true
}).walkNumerics(({ value, unit: valueUnit }) => {
// Return early if not a checked unit
if (!lengthUnits.includes(valueUnit)) return;
// Validate scale and units
const validUnit = unit ? valueUnit === unit : true;
const validScale = scale.includes(Number(value));
// Get message of the violation
let message;
if (!validScale) {
message = messages.expected(`${value}`, scale.join(", "));
} else if (!validUnit) {
message = messages.expected(`${valueUnit}`, `${unit}`);
} else {
function check(decl, size) {
// Parse the size and walk through Numerics
parse(size, {
ignoreUnknownWords: true
}).walkNumerics(({ value, unit: valueUnit }) => {
// Return early if not a checked unit
if (!lengthUnits.includes(valueUnit)) return;
// Validate scale and units
const validUnit = unit ? valueUnit === unit : true;
const validScale = scale.includes(Math.abs(Number(value)));
// Get message of the violation
let message;
if (!validScale) {
message = messages.expected(`${value}`, scale.join(", "));
} else if (!validUnit) {
message = messages.expected(`${valueUnit}`, `${unit}`);
} else {
rule.nodes.slice().forEach(decl => {
if (isCustomDecl(decl) && !isBlockIgnored(decl)) {
const { prop } = decl;
// write the parsed value to the custom property
customPropertiesObject[prop] = parse(decl.value).nodes;
// conditionally remove the custom property declaration
if (!opts.preserve) {
decl.remove();
}
}
});
export default (originalValue, variables) => {
// get the ast of the original value
const ast = parse(originalValue);
// walk all of the css env() functions
walkEnvFuncs(ast, node => {
// update the environment value for the css env() function
updateEnvValue(node, variables);
});
// return the stringified ast
return String(ast);
};
function getSingleTimingFunction(animation) {
let timingFunction
parse(animation).walk(node => {
// There should only be one timing function per shorthand
if (timingFunction) {
return
}
// Look for timing keywords
if (
node.type === 'word' &&
[
'ease',
'ease-in',
'ease-in-out',
'ease-out',
'linear',
'step-start',
'step-end'
function check(decl, size) {
// Parse the size and walk through Numerics
parse(size, {
ignoreUnknownWords: true
}).walkNumerics(({ value, unit: valueUnit }) => {
// Return early if not a checked unit
if (!lengthUnits.includes(valueUnit)) return;
// Validate scale and units
const validUnit = unit ? valueUnit === unit : true;
const validScale = scale.includes(Math.abs(Number(value)));
// Get message of the violation
let message;
if (!validScale) {
message = messages.expected(`${value}`, scale.join(", "));
} else if (!validUnit) {
message = messages.expected(`${valueUnit}`, `${unit}`);
} else {