How to use json-stable-stringify-without-jsonify - 3 common examples

To help you get started, we’ve selected a few json-stable-stringify-without-jsonify 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 oVirt / ovirt-web-ui / scripts / intl / normalize-messages.js View on Github external
function main() {
  const stringContent = fs.readFileSync(SOURCE, { encoding: 'utf8' })
  const parsedContent = JSON.parse(stringContent)
  removeEmptyMessages(parsedContent)
  const serializedContent = stableStringify(parsedContent, { space: 2 }) + '\n'
  fs.writeFileSync(DESTINATION, serializedContent)
  console.log(chalk.green(`[normalize-messages.js] ${DESTINATION} written ✔`))
}
github cockpit-project / cockpit / pkg / storaged / crypto-keyslots.jsx View on Github external
function compute_thp(jwk) {
    var REQUIRED_ATTRS = {
        RSA: ['kty', 'p', 'd', 'q', 'dp', 'dq', 'qi', 'oth'],
        EC:  ['kty', 'crv', 'x', 'y'],
        oct: ['kty', 'k'],
    };

    if (!jwk.kty)
        return "(no key type attribute=";
    if (!REQUIRED_ATTRS[jwk.kty])
        return cockpit.format("(unknown keytype $0)", jwk.kty);

    var req = REQUIRED_ATTRS[jwk.kty];
    var norm = { };
    req.forEach(k => { if (k in jwk) norm[k] = jwk[k]; });
    return jwk_b64_encode(sha1.digest(stable_stringify(norm)));
}
github microsoft / fluent-ui-react / build / gulp / tasks / stats.ts View on Github external
function updateStatsFile(filePath: string, currentBundleStats: any) {
  const stats = fs.existsSync(filePath) ? require(filePath) : {}

  stats[UNRELEASED_VERSION_STRING] = {
    bundles: currentBundleStats,
  }

  fs.writeFileSync(
    filePath,
    stableStringify(stats, {
      cmp: semverCmp,
      space: 2,
    }),
  )
}

json-stable-stringify-without-jsonify

deterministic JSON.stringify() with custom sorting to get deterministic hashes from stringified results, with no public domain dependencies

MIT
Latest version published 8 years ago

Package Health Score

65 / 100
Full package analysis

Popular json-stable-stringify-without-jsonify functions