MCPcopy Index your code
hub / github.com/apache/pouchdb / tryAndPut

Function tryAndPut

lib/index.js:760–773  ·  view source on GitHub ↗
(db, doc, diffFun)

Source from the content-addressed store, hash-verified

758}
759
760function tryAndPut(db, doc, diffFun) {
761 return db.put(doc).then(function (res) {
762 return {
763 updated: true,
764 rev: res.rev
765 };
766 }, function (err) {
767 /* istanbul ignore next */
768 if (err.status !== 409) {
769 throw err;
770 }
771 return upsert(db, doc._id, diffFun);
772 });
773}
774
775function binaryMd5(data, callback) {
776 var base64 = crypto.createHash('md5').update(data, 'binary').digest('base64');

Callers 1

upsertFunction · 0.70

Calls 1

upsertFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…