pouchdb-upsert-if-changed
v1.0.1
Published
Upsert if unchanged plugin for PouchDB
Downloads
3
Readme
pouchdb-upsert-if-changed
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'}))
Installation
npm install --save pouchdb-upsert-if-changed
Usage
upsertIfChanged(<doc>)
import PouchDB from 'pouchdb'
import upsert from 'pouchdb-upsert'
import upsertIfChanged from 'pouchdb-upsert-if-changed'
PouchDB
.plugin(upsert)
.plugin(upsertIfChanged)
Author
© 2017 Tom Vincent [email protected] (https://tlvince.com)
License
Released under the MIT license.