Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.logDiff = function logDiff(expected, actual) {
console.log(json.stringify(diff(actual, expected), null, 4));
};
function parseDataLinksHelper(patternlab, obj, key) {
var linkRE, dataObjAsString, linkMatches, expandedLink;
linkRE = /link\.[A-z0-9-_]+/g;
dataObjAsString = JSON5.stringify(obj);
linkMatches = dataObjAsString.match(linkRE);
if (linkMatches) {
for (var i = 0; i < linkMatches.length; i++) {
expandedLink = patternlab.data.link[linkMatches[i].split('.')[1]];
if (expandedLink) {
if (patternlab.config.debug) {
console.log('expanded data link from ' + linkMatches[i] + ' to ' + expandedLink + ' inside ' + key);
}
dataObjAsString = dataObjAsString.replace(linkMatches[i], expandedLink);
}
}
}
var dataObj;
try {
traverseProperty(input, function ({ value, property, selector }) {
if (property === 'transform') {
const arr = [];
const match = value.replace(/(\w+)\s*\(([^)]+)\)\s*/g, (nothing, name, value) => {
if (value.match(/^[\d\.]+$/)) {
value = value * 1;
}
arr.push({ [name]: value });
});
return JSON5.stringify(arr);
}
});
const regexpArr = args.split(',').map(arg => arg.trim()).map(name => new RegExp(`(^|['"])` + name + "([\\[\\.\"? *\/+-]|$)"));
function writeConfig() {
fs.outputFileSync(userConfigFile, JSON5.stringify(rawConfig, null, 2), 'utf8')
}
scafolder(argv).then(props => {
const doc = template(props);
fs.outputFile(props.fileName, JSON5.stringify(doc, null, 2))
.then(resolve);
});
});
function format() {
var netlist = json5.parse(textarea.value);
textarea.value = json5.stringify(netlist, null, 4);
}
function set(key, value) {
prefs[key] = value;
fs.writeFileSync(path.join(electron.app.getPath("userData"), "preferences.json"), JSON5.stringify(prefs, undefined, " "));
}
let arglist = argv.slice(1).map(arg => {
try { arg = json5.parse(arg) } catch (e) { }
if (typeof context[arg] === 'string' && validateIdentifier(arg)) {
return arg
} else {
try {
let file = expandHomeDir(arg)
if (fs.existsSync(file)) arg = file
} catch (e) { }
return json5.stringify(arg)
}
})
if (pipeLevel) {
modelCode() {
return JSON5.stringify(this.model, false, 4);
},
schemaCode() {