How to use the spark-md5.hash function in spark-md5

To help you get started, we’ve selected a few spark-md5 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 pubkey / rxdb / test / playground / hash-vs-deepequal / index.js View on Github external
function compareHashMD5({
    obj,
    clone
}) {
    // equal
    const hash1 = hash(JSON.stringify(obj));
    const hash2 = hash(JSON.stringify(clone));
    assert.equal(hash1, hash2);

    // not equal
    const hash3 = hash(JSON.stringify(obj));
    const hash4 = hash(JSON.stringify(checkObj));
    assert.notEqual(hash3, hash4);

    return;
}
github pubkey / rxdb / test / playground / hash-vs-deepequal / index.js View on Github external
function compareHashMD5({
    obj,
    clone
}) {
    // equal
    const hash1 = hash(JSON.stringify(obj));
    const hash2 = hash(JSON.stringify(clone));
    assert.equal(hash1, hash2);

    // not equal
    const hash3 = hash(JSON.stringify(obj));
    const hash4 = hash(JSON.stringify(checkObj));
    assert.notEqual(hash3, hash4);

    return;
}
github instamed / healthcare-payments-blockchain / packages / frontend / src / components / Provider.vue View on Github external
text: "Married"
        },
        managingOrganization: {
          identifier: {
            $class: "org.fhir.datatypes.Identifier",
            use: "usual",
            system: "Blockchain:Provider",
            value: "Provider::Provida"
          }
        }
      };
      // Hash the object and set the ID to the hash. This creates a unique ID with low chance of collision, which is good enough for our purposes here.
     
      // USE THIS TO CREATE NEW PATIENTS. THIS IS COMMENTED OUT TO REUSE THE SAME DEFAULT PATIENT ID
      json.id = "resource:org.fhir.core.Patient#com.instamed.patient.".concat(this.first_name, "_", this.last_name, "_",
        Spark.hash(JSON.stringify(json)).toString().substring(0,8)
      );
     
      
      json.identifier[0].value = json.id;
      this.patient_id = json.id.toString();
      this.$emit("saveFhir", {name: 'fhir_patient', data: json})
      return json;
    },
    savePatient() {
github reactGo / reactGo / app / actions / topics.js View on Github external
return (dispatch, getState) => {
    // If the text box is empty
    if (text.trim().length <= 0) return;

    const id = md5.hash(text);
    // Redux thunk's middleware receives the store methods `dispatch`
    // and `getState` as parameters
    const { topic } = getState();
    const data = {
      count: 1,
      id,
      text
    };

    // Conditional dispatch
    // If the topic already exists, make sure we emit a dispatch event
    if (topic.topics.filter(topicItem => topicItem.id === id).length > 0) {
      // Currently there is no reducer that changes state for this
      // For production you would ideally have a message reducer that
      // notifies the user of a duplicate topic
      return dispatch(createTopicDuplicate());
github nolanlawson / pouchdb-find / lib / utils.js View on Github external
exports.MD5 = function (string) {
  /* istanbul ignore else */
  if (!process.browser) {
    return crypto.createHash('md5').update(string).digest('hex');
  } else {
    return Md5.hash(string);
  }
};
github apigee-127 / swagger-tools / lib / specs.js View on Github external
.then(function (results) {
        removeCirculars(results.resolved);

        // Fix circular references
        _.each(results.refs, function (refDetails, refPtr) {
          if (refDetails.circular) {
            _.set(results.resolved, JsonRefs.pathFromPtr(refPtr), {});
          }
        });

        cacheEntry.referencesMetadata = results.refs;
        cacheEntry.resolved = results.resolved;
        cacheEntry.resolvedId = SparkMD5.hash(JSON.stringify(results.resolved));

        callback();
      })
      .catch(callback);
github instamed / healthcare-payments-blockchain / packages / frontend / src / components / Payer.vue View on Github external
benefit: service.unitPrice * this.elgibilityPercentage
          }
        };
        adjudications.push(s);
      }

      let json = {
        txDate: this.claim_timestamp.toISOString().slice(0, 10),
        uid: "resource:org.fhir.core.ClaimResponse#",
        claimUid: this.claim.claim_uid,
        accountUid: "resource:org.fhir.core.Account#",
        invoiceUid: "resource:org.fhir.core.Invoice#",
        adjudications: adjudications
      };

      let id1 = Spark.hash(JSON.stringify(json))      
      json.accountUid = json.accountUid.concat(id1);
      json.uid = json.uid.concat(id1);
      json.invoiceUid = json.invoiceUid.concat(id1, "-1");
      this.invoice_uid = json.invoiceUid;
      this.account_uid =json.accountUid;
      this.claim_response_uid = json.uid
      this.$emit("saveFhir", {name: 'fhir_adjudication', data: json})
      return json;
    },
    approveClaim() {
github oeway / ImJoy / web / src / pluginManager.js View on Github external
async checkPluginUpdate(plugin) {
    const pconfig = plugin.config;
    const config = await this.getPluginFromUrl(
      pconfig.origin,
      this.available_plugins
    );
    if (pconfig.hash) {
      if (pconfig.hash !== SparkMD5.hash(config.code)) {
        if (compareVersions(pconfig.version, "<=", config.version)) {
          plugin.update_available = true;
        } else {
          plugin.update_available = false;
        }
      } else {
        plugin.update_available = false;
      }
    } else {
      if (compareVersions(pconfig.version, "<", config.version)) {
        plugin.update_available = true;
      } else {
        plugin.update_available = false;
      }
    }
    this.update_ui_callback();
github pubkey / rxdb / dist / es / util.js View on Github external
export function hash(obj) {
  var msg = obj;
  if (typeof obj !== 'string') msg = JSON.stringify(obj);
  return Md5.hash(msg);
}
/**
github apigee-127 / swagger-tools / lib / specs.js View on Github external
var getDocumentCache = function (apiDOrSO) {
  var key = SparkMD5.hash(JSON.stringify(apiDOrSO));
  var cacheEntry = documentCache[key] || _.find(documentCache, function (cacheEntry) {
    return cacheEntry.resolvedId === key;
  });

  if (!cacheEntry) {
    cacheEntry = documentCache[key] = {
      definitions: {},
      original: apiDOrSO,
      resolved: undefined,
      swaggerVersion: helpers.getSwaggerVersion(apiDOrSO)
    };
  }

  return cacheEntry;
};

spark-md5

Lightning fast normal and incremental md5 for javascript

WTFPL
Latest version published 3 years ago

Package Health Score

73 / 100
Full package analysis