1.0.1 • Published 7 years ago

pouchdb-upsert-if-changed v1.0.1

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

pouchdb-upsert-if-changed

Build Status npm version License

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 git@tlvince.com (https://tlvince.com)

License

Released under the MIT license.

1.0.1

7 years ago

1.0.0

7 years ago