npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ouch-rx

v2.1.2

Published

Reactive wrapper for pouchdb

Downloads

6

Readme

Ouch Rx Build Status Coverage Status

Library wrapping PouchDB with rxjs observables.

Usage

To use Ouch Rx one have to wrap database object with Ouch instance and then use its methods to create Observables and Observers.

const {Ouch} = require('ouch-rx');
const ouch = new Ouch(db);
ouch.all().pipe(transform).subscribe(ouch.sink())

Reference

Constructor

Wraps single pouchdb database.

new Ouch(db)

|Argument| Description| |---|---| | db | A PouchDB database |

Methods

all

Returns observable of all documents.

ouch.all(options)

|Argument| Description| |---|---| | options | An options object passed to db.all_docs. The following fields are not passed: include_docs |

changes

Returns observable of a change feed.

ouch.changes(options)

|Argument| Description| |---|---| | options | An options object passed to db.changes.|

view

Returns observable of view results.

ouch.view(name,options)

|Argument| Description| |---|---| | name | A view name | | options | An options object passed to db.query. The following fields are not passed: include_docs |

To use this method the db object must support query method.

sink

Returns observer that writes incoming objects into db.

The operation will fail on any error so it is useful for inserting completely new documents and for updating documents previously fetched from db (so current _rev is known).

ouch.sink()

merge

Returns observer that writes incoming objects into db.

The operation will call the merge function with incoming object to prepare document to store. The operation will call the merge function again with incoming object and current document state if conflict is encountered. It will then retry write with the result of merge function.

ouch.merge(mergeFunction)    

|Argument| Description| |---|---| | mergeFunction | A merge function (object,current) => document to store |

Merge Functions

The following ready to use merge functions are provided

  • skip - if document exist in database then skip update
  • override - override document in database with new document
  • assign - merge the existing and new document the way that uses new properties over existing but leave existing properties if new values are not provided. The merge is shallow, it considers only top level properties.