MCPcopy Create free account
hub / github.com/microsoft/SandDance / rtlifyRules

Function rtlifyRules

docs/app/js/sanddance-app.js:22279–22301  ·  view source on GitHub ↗
(options, rulePairs, index)

Source from the content-addressed store, hash-verified

22277 "nw-resize": "ne-resize"
22278};
22279function rtlifyRules(options, rulePairs, index) {
22280 if (options.rtl) {
22281 var name_1 = rulePairs[index];
22282 if (!name_1) return;
22283 var value = rulePairs[index + 1];
22284 if (typeof value === "string" && value.indexOf(NO_FLIP) >= 0) rulePairs[index + 1] = value.replace(/\s*(?:\/\*\s*)?\@noflip\b(?:\s*\*\/)?\s*?/g, "");
22285 else if (name_1.indexOf(LEFT) >= 0) rulePairs[index] = name_1.replace(LEFT, RIGHT);
22286 else if (name_1.indexOf(RIGHT) >= 0) rulePairs[index] = name_1.replace(RIGHT, LEFT);
22287 else if (String(value).indexOf(LEFT) >= 0) rulePairs[index + 1] = value.replace(LEFT, RIGHT);
22288 else if (String(value).indexOf(RIGHT) >= 0) rulePairs[index + 1] = value.replace(RIGHT, LEFT);
22289 else if (NAME_REPLACEMENTS[name_1]) rulePairs[index] = NAME_REPLACEMENTS[name_1];
22290 else if (VALUE_REPLACEMENTS[value]) rulePairs[index + 1] = VALUE_REPLACEMENTS[value];
22291 else switch(name_1){
22292 case "margin":
22293 case "padding":
22294 rulePairs[index + 1] = flipQuad(value);
22295 break;
22296 case "box-shadow":
22297 rulePairs[index + 1] = negateNum(value, 0);
22298 break;
22299 }
22300 }
22301}
22302/**
22303 * Given a string value in a space delimited format (e.g. "1 2 3 4"), negates a particular value.
22304 */ function negateNum(value, partIndex) {

Callers

nothing calls this directly

Calls 3

flipQuadFunction · 0.85
negateNumFunction · 0.85
replaceMethod · 0.80

Tested by

no test coverage detected