Upsert if changed plugin for PouchDB
const doc = { _id: 'foo' }
db.put(doc)
// Does nothing
.then(() => db.upsertIfChanged(doc))
// Upserts
.then(() => db.upsertIfChanged({_id: 'foo', bar: 'baz'}))
npm install --save pouchdb-upsert-if-changed
upsertIfChanged(<doc>)
import PouchDB from 'pouchdb'
import upsert from 'pouchdb-upsert'
import upsertIfChanged from 'pouchdb-upsert-if-changed'
PouchDB
.plugin(upsert)
.plugin(upsertIfChanged)
© 2017 Tom Vincent git@tlvince.com (https://tlvince.com)
Released under the MIT license.