How to use the json5.stringify function in json5

To help you get started, we’ve selected a few json5 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vorpaljs / bash-parser / test / _utils.js View on Github external
exports.logDiff = function logDiff(expected, actual) {
	console.log(json.stringify(diff(actual, expected), null, 4));
};
github pattern-lab / patternlab-node / core / lib / pattern_assembler.js View on Github external
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 {
github blackmiaool / rn-less / src / index.js View on Github external
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 + "([\\[\\.\"? *\/+-]|$)"));
github zaaack / ELaunch / app / config / index.js View on Github external
function writeConfig() {
  fs.outputFileSync(userConfigFile, JSON5.stringify(rawConfig, null, 2), 'utf8')
}
github sifive / duh / lib / index.js View on Github external
scafolder(argv).then(props => {
    const doc = template(props);
    fs.outputFile(props.fileName, JSON5.stringify(doc, null, 2))
      .then(resolve);
  });
});
github nturley / netlistsvg / demo / demo.js View on Github external
function format() {
    var netlist = json5.parse(textarea.value);
    textarea.value = json5.stringify(netlist, null, 4);
}
github blocktronics / moebius / app / prefs.js View on Github external
function set(key, value) {
    prefs[key] = value;
    fs.writeFileSync(path.join(electron.app.getPath("userData"), "preferences.json"), JSON5.stringify(prefs, undefined, "  "));
}
github rikumi / fresh-shell / plugins / eval.js View on Github external
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) {
github blackmiaool / vue-form10 / src / components / Home.vue View on Github external
modelCode() {
            return JSON5.stringify(this.model, false, 4);
        },
        schemaCode() {

json5

JSON for Humans

MIT
Latest version published 2 years ago

Package Health Score

87 / 100
Full package analysis