open-index/open-npm huggingface dataset:
npm package: @nhz.io/pouch-db-job-scheduler
Description: PouchDB Job Scheduler (replicate/sync)
Author: Ishi Ruy
Latest version: 0.1.3

# PouchDB Job Scheduler (replicate/sync)

[![Travis Build][travis]](https://travis-ci.org/nhz-io/nhz-io-pouch-db-job-scheduler)
[![NPM Version][npm]](https://www.npmjs.com/package/@nhz.io/pouch-db-job-scheduler)

## Install

```bash
npm i -S @nhz.io/pouch-db-job-scheduler
```

## Usage

* Extend `Scheduler` class with your desired behaviour
* `Scheduler` extends [p-queue], so interface is the same essentially with some additions
* constructor `opts` should include `PouchDB` property (will be copied to instance)

```js
const PouchDB = require 'pouchdb'
const Scheduler = require('@nhz.io/pouch-db-job-scheduler')
const replicate = require('@nhz.io/pouch-db-replication-job')

class MyScheduler extends Scheduler {
  /* ... */
}

const scheduler = new MyScheduler({ PouchDB, concurrency: 1 })

scheduler.addAll([ replicate({}, 'http://foo', 'foo'), replicate({}, 'foo', 'bar'), /* ... */ ])

/* ... */
```

## Literate Source

### Import

    PQueue = require 'p-queue'

### Scheduler

    class Scheduler extends PQueue

      constructor: (opts) ->
        super opts

        @PouchDB = opts?.PouchDB or PouchDB

      add: (run, args...) -> super (@prepare run, args...)

> Prepare job for run (Binding cleanup upon completion/fail)

      prepare: (run) -> () =>

        job = run { @PouchDB }

        job.then () => @cleanup job

        job.catch => @cleanup job

        job

> Need to call stop on any pouchdb job to unbind listeners

      cleanup: (job) ->

        job.stop()

        null


### Exports

    module.exports = Scheduler

## Tests

    test = require 'tape-async'

    PouchDB = require 'pouchdb-memory'
    PQueue = require 'p-queue'

    replicate = require '@nhz.io/pouch-db-replication-job'

    mkdb = (i, n = 0) ->

      db = new PouchDB "db-#{ i }"

      await db.put { _id: "doc-#{ i + 1 }" } for i in [0...n]

      db

> Base Scheduler test

    test 'Scheduler', (t) ->

      rand = Math.random().toString().slice(3)

      scheduler = new Scheduler ({ concurrency: 1 })

      source = await mkdb 1 + rand, 2

      target = await mkdb 5 + rand

      jobs = for i in [1..4] then replicate {}, "db-#{ i + rand }", await mkdb i + 1 + rand

      await scheduler.addAll jobs

      t.deepEqual await source.allDocs(), await target.allDocs()

## Version 0.1.3

## License [MIT](LICENSE)

[travis]: https://img.shields.io/travis/nhz-io/nhz-io-pouch-db-job-scheduler.svg?style=flat
[npm]: https://img.shields.io/npm/v/@nhz.io/pouch-db-job-scheduler.svg?style=flat

[p-queue]: https://github.com/sindresorhus/p-queue
npm package: @nhz.io/pouch-db-manager
Description: PouchDB Connections Manager
Author: Ishi Ruy
Latest version: 0.2.2

# PouchDB Connections Manager

[![Travis Build][travis]](https://travis-ci.org/nhz-io/nhz-io-pouch-db-manager)
[![Coverage][coveralls]](https://coveralls.io/github/nhz-io/nhz-io-pouch-db-manager)
[![NPM Version][npm]](https://www.npmjs.com/package/@nhz.io/pouch-db-manager)

## Install

```bash
npm i -S @nhz.io/pouch-db-manager
```

## Usage
```js
const pouchDbManager = require('@nhz.io/pouch-db-manager')

...
```

## Version 0.2.2

## License [MIT](LICENSE)

[travis]: https://img.shields.io/travis/nhz-io/nhz-io-pouch-db-manager.svg?style=flat
[npm]: https://img.shields.io/npm/v/@nhz.io/pouch-db-manager.svg?style=flat
[coveralls]: https://coveralls.io/repos/github/nhz-io/nhz-io-pouch-db-manager/badge.svg?branch=v0.2.2
npm package: @nhz.io/pouch-db-manager-helpers
Description: PouchDB Manager Helpers
Author: Ishi Ruy
Latest version: 0.1.7

# PouchDB Manager Helpers

[![Travis Build][travis]](https://travis-ci.org/nhz-io/nhz-io-pouch-db-manager-helpers)
[![NPM Version][npm]](https://www.npmjs.com/package/@nhz.io/pouch-db-manager-helpers)

## Install

```bash
npm i -S @nhz.io/pouch-db-manager-helpers
```

## Usage
```js
const helpers = require('@nhz.io/pouch-db-manager-helpers')

...
```

## Literate Source

### Helpers

    assign = (args...) -> Object.assign {}, args...

    allPass = (predicates) ->

      predicates = predicates.filter (i) -> i

      (test) ->

        return for predicate in predicates when not predicate test

        true

    isObject = (target) -> typeof target is 'object'

    priority = (test) -> ['sync', 'live', 'realtime'].indexOf test

### Sanitizers

    dbname = (db) -> if isObject db then db.name else db

    docid = (doc) -> if isObject doc then doc._id else doc

    urlname = (url) ->

      url = new URL url

      "#{ url.host }#{ url.pathname }"

### Generators

    mkkey = (resource) -> switch resource.type

      when 'sync' then "#{ resource.local } <-> #{ resource.remote }"

      when 'push' then "#{ resource.local } -> #{ resource.remote }"

      when 'pull' then "#{ resource.local } <- #{ resource.remote }"

    mkconf = (resource, key = mkkey resource) ->

      return unless key

      { type, queue, local, remote } = resource

      { key, type, queue, local, remote, retry: false, live: queue in ['realtime', 'live'] }

    mkname = (target) ->

      name = unless isObject target then target else target.name

      unless name.match? /^https?:\/\// then name else urlname name

### Exports

    module.exports = {
      assign, allPass, isObject, dbname, docid, urlname, mkkey, mkconf, priority, mkname
    }

## Tests

    test = require 'tape-async'

    test 'exports', (t) ->
      t.plan 1

      t.deepEqual module.exports, {
        assign, allPass, isObject, dbname, docid, urlname, mkkey, mkconf, priority, mkname
      }

## Version 0.1.7

## License [MIT](LICENSE)

[travis]: https://img.shields.io/travis/nhz-io/nhz-io-pouch-db-manager-helpers.svg?style=flat
[npm]: https://img.shields.io/npm/v/@nhz.io/pouch-db-manager-helpers.svg?style=flat
npm package: @nhz.io/ref-node
Description: Value reference node Class
Author: Ishi Ruy
Latest version: 1.0.8

<h1 align="center">@nhz.io/ref-node</h1>

<p align="center">
  <a href="https://npmjs.org/package/@nhz.io/ref-node">
    <img src="https://img.shields.io/npm/v/@nhz.io/ref-node.svg?style=flat"
         alt="NPM Version">
  </a>

  <a href="https://www.bithound.io/github/nhz-io/ref-node">
    <img src="https://www.bithound.io/github/nhz-io/ref-node/badges/score.svg"
         alt="Bithound Status">
  </a>

  <a href="https://github.com/nhz-io/ref-node/blob/master/LICENSE">
    <img src="https://img.shields.io/github/license/nhz-io/ref-node.svg?style=flat"
         alt="License">
  </a>

  <a href="https://npmjs.org/package/@nhz.io/ref-node">
  <img src="http://img.shields.io/npm/dm/@nhz.io/ref-node.svg?style=flat"
  alt="Downloads">
  </a>  
</p>

<h3 align="center">"Value reference node" Class<h2>

## Install
```
npm i -S @nhz.io/ref-node
```

## Class: RefNode
### new RefNode(root, path)
* `root` - `{Array | Object}`
* `path` - `{Array<String | Number>}`

#### Creates a reference node for the root object at the given path.
* With root: `{a: {b: 'foo'}}` and path: `['a', 'b']`, the node will
reference `'foo'` value of the `a.b` Object   

* With root; `{a: b: [null, 'bar']}` and path: `['a', 'b', 1]`, the node
will reference `'bar'` value of the `a.b` Array at index `1`

### Properties

* `root` - Root getter/setter
* `parent` - Parent getter
* `path` -  Path getter/setter
* `key` - Key getter/setter
* `resolves` - Resolves getter

## Example

### Object key reference
```javascript

const RefNode = require('@nhz.io/ref-node')
const root = {a: {b: 'foobar'}}
const node = new RefNode(root, ['a', 'b'])
console.log(node.value) // Prints 'foobar'
node.value = 'barfoo'
console.log(root.a.b) // Prints 'barfoo'
```

### Array element reference
```javascript
const RefNode = require('@nhz.io/ref-node')
const root = {a: {b: [null, 'foobar']}}
const node = new RefNode(root, ['a', 'b', 1])
console.log(node.value) // Prints 'foobar'
node.value = 'barfoo'
console.log(root.a.b[1]) // Prints 'barfoo'
```
npm package: @nhz.io/ref-resolve
Description: JSON references resolver
Author: Ishi Ruy
Latest version: 1.0.2

<h1 align="center">@nhz.io/ref-resolve</h1>

<p align="center">
  <a href="https://npmjs.org/package/@nhz.io/ref-resolve">
    <img src="https://img.shields.io/npm/v/@nhz.io/ref-resolve.svg?style=flat"
         alt="NPM Version">
  </a>

  <a href="https://www.bithound.io/github/nhz-io/ref-resolve">
    <img src="https://www.bithound.io/github/nhz-io/ref-resolve/badges/score.svg"
         alt="Bithound Status">
  </a>

  <a href="https://github.com/nhz-io/ref-resolve/blob/master/LICENSE">
    <img src="https://img.shields.io/github/license/nhz-io/ref-resolve.svg?style=flat"
         alt="License">
  </a>

  <a href="https://npmjs.org/package/@nhz.io/ref-resolve">
  <img src="http://img.shields.io/npm/dm/@nhz.io/ref-resolve.svg?style=flat"
  alt="Downloads">
  </a>  
</p>

<h3 align="center">JSON references resolver<h2>

## Install
```
npm i -S @nhz.io/ref-resolve
```

## Example

### Successful reference resolution
```javascript
const resolve = require('@nhz.io/ref-resolve')
const result = resolve({
    a: {foo: 'FOO', bar: 'BAR'},
    b: {foo: '${a.foo}', bar: '${a.bar}'},
    c: '${a.foo}${b.bar}',
})
/* result = {
    a: { foo: 'FOO', bar: 'BAR' },
    b: { foo: 'FOO', bar: 'BAR' },
    c: 'FOOBAR',
} */
```

### Get unresolved references
```javascript
const resolve = require('@nhz.io/ref-resolve')
const unresolved = []
const result = resolve({
    a: {foo: 'FOO', bar: 'BAR'},
    b: {foo: '${a.FOO}', bar: '${a.BAR}'},
    c: '${a.FOO}${a.BAR}'
}, unresolved)
/* result = {
    a: { foo: 'FOO', bar: 'BAR' },
    b: {},
} */

/* unresolved = ['${a.FOO}', '${a.BAR}'] */

```

## License

### [MIT](LICENSE)
npm package: @nhz.io/rollup-plugin-commonjs
Description: Convert CommonJS modules to ES2015
Author: Rich Harris
Latest version: 4.1.0

# rollup-plugin-commonjs [![Build Status][travis-img]][travis]

[travis-img]: https://travis-ci.org/rollup/rollup-plugin-commonjs.svg
[travis]: https://travis-ci.org/rollup/rollup-plugin-commonjs

Convert CommonJS modules to ES6, so they can be included in a Rollup bundle


## Installation

```bash
npm install --save-dev rollup-plugin-commonjs
```


## Usage

Typically, you would use this plugin alongside [rollup-plugin-node-resolve](https://github.com/rollup/rollup-plugin-node-resolve), so that you could bundle your CommonJS dependencies in `node_modules`.

```js
import { rollup } from 'rollup';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';

rollup({
  entry: 'main.js',
  plugins: [
    nodeResolve({
      jsnext: true,
      main: true
    }),

    commonjs({
      // non-CommonJS modules will be ignored, but you can also
      // specifically include/exclude files
      include: 'node_modules/**',  // Default: undefined
      exclude: [ 'node_modules/foo/**', 'node_modules/bar/**' ],  // Default: undefined

      // search for files other than .js files (must already
      // be transpiled by a previous plugin!)
      extensions: [ '.js', '.coffee' ],  // Default: [ '.js' ]

      // if true then uses of `global` won't be dealt with by this plugin
      ignoreGlobal: false,  // Default: false

      // if false then skip sourceMap generation for CommonJS modules
      sourceMap: false,  // Default: true
      
      // explicitly specify unresolvable named exports
      // (see below for more details)
      namedExports: { './module.js': ['foo', 'bar' ] }  // Default: undefined 
    })
  ]
}).then(...)
```

### Custom named exports

This plugin will attempt to create named exports, where appropriate, so you can do this...

```js
// importer.js
import { named } from './exporter.js';

// exporter.js
module.exports = { named: 42 }; // or `exports.named = 42;`
```

...but that's not always possible:

```js
// importer.js
import { named } from 'my-lib';

// my-lib.js
var myLib = exports;
myLib.named = 'you can\'t see me';
```

In those cases, you can specify custom named exports:

```js
commonjs({
  namedExports: {
    // left-hand side can be an absolute path, a path
    // relative to the current directory, or the name
    // of a module in node_modules
    'node_modules/my-lib/index.js': [ 'named' ]
  }
});
```


## License

MIT
npm package: @nhz.io/slush-m
Description: Micro module generator (@nhz.io scoped)
Author: Ishi Ruy
Latest version: 1.0.5

# Module generator (@nhz.io scoped)

[![Travis Build][travis]](https://travis-ci.org/nhz-io/nhz-io-slush-m)
[![NPM Version][npm]](https://www.npmjs.com/package/@nhz.io/slush-m)


## Install

```bash
npm i -g slush @nhz.io/slush-m
```

## Usage
```bash
mkdir mod && cd mod

slush @nhz.io/m
```

## Literate Source

### Imports

> Builtins

    path     = require 'path'

> General

    gulp     = require 'gulp'
    pump     = require 'pump'
    inquirer = require 'inquirer'

> Gulp plugins

    install  = require 'gulp-install'
    conflict = require 'gulp-conflict'
    template = require 'gulp-template'
    rename   = require 'gulp-rename'

> String utils imports

    slugify   = require 'slugify'
    camelcase = require 'camelcase'

## Default task

    gulp.task 'default', ->

      answers = await inquirer.prompt [
        {
          name: 'pkgName'
          message: 'Package name?'

> Strip scope prefix from default package name

          default: (path.basename process.cwd()).replace /^(nhz-io-)?/, ''
        }
        {
          name: 'pkgDescription'
          message: 'Description?'
        }
        {
          name: 'pkgVersion'
          message: 'Version?'
          default: '0.0.0'
        }
        {
          type: 'confirm'
          name: 'continue'
          message: 'Continue?'
        }
      ]

      return done() unless answers.continue

> Strip scope prefix from package name

      answers.pkgName = answers.pkgName.replace(/^nhz-io-/, '')

> Slugify

      answers.pkgNameSlug = slugify answers.pkgName, '-'

> Camel Case

      answers.pkgNameCamelCase = camelcase answers.pkgName

> Generate package

      pump [
        gulp.src __dirname + '/templates/**/*'

        template answers

        rename (f) -> if f.basename[0] is '_' then f.basename = ".#{ f.basename.slice 1 }"

        conflict './'

        gulp.dest './'

        install()
      ]


## Version 1.0.5
## License [MIT](LICENSE)

[travis]: https://img.shields.io/travis/nhz-io/nhz-io-slush-m.svg?style=flat
[npm]: https://img.shields.io/npm/v/@nhz.io/slush-m.svg?style=flat
npm package: @nhz.io/slush-um
Description: Micro module generator (@nhz.io scoped)
Author: Ishi Ruy
Latest version: 1.1.5

# Micro module generator (@nhz.io scoped)

[![Travis Build][travis]](https://travis-ci.org/nhz-io/nhz-io-slush-um)
[![NPM Version][npm]](https://www.npmjs.com/package/@nhz.io/slush-um)

## You get:

* **TDD Dev environment configured for tiny packages**
* **Literate Coffeescript template to start with (README.litcoffee)**
>
* `npm start` - to start TDD
* `npm build`
>
* [coffeescript 2]
* [coffeelint]
* [coffeetape]
* [faucet]
* [tape-async]
* [chokidar-cli]
* [husky]
>
* `.travis.yml` for scoped publish (public) - just set `NPM_AUTH_TOKEN`

## Install

```bash
npm i -g slush @nhz.io/slush-um
```

## Usage
```bash
mkdir um && cd um

slush @nhz.io/um
```

## Literate Source

### Imports

> Builtins

    path     = require 'path'

> General

    gulp     = require 'gulp'
    pump     = require 'pump'
    inquirer = require 'inquirer'

> Gulp plugins

    install  = require 'gulp-install'
    conflict = require 'gulp-conflict'
    template = require 'gulp-template'
    rename   = require 'gulp-rename'

> String utils imports

    slugify   = require 'slugify'
    camelcase = require 'camelcase'

## Default task

    gulp.task 'default', ->

      answers = await inquirer.prompt [
        {
          name: 'pkgName'
          message: 'Package name?'

> Strip scope prefix from default package name

          default: (path.basename process.cwd()).replace /^(nhz-io-)?/, ''
        }
        {
          name: 'pkgDescription'
          message: 'Description?'
        }
        {
          name: 'pkgVersion'
          message: 'Version?'
          default: '0.0.0'
        }
        {
          type: 'confirm'
          name: 'continue'
          message: 'Continue?'
        }
      ]

      return done() unless answers.continue

> Strip scope prefix from package name

      answers.pkgName = answers.pkgName.replace(/^nhz-io-/, '')

> Slugify

      answers.pkgNameSlug = slugify answers.pkgName, '-'

> Camel Case

      answers.pkgNameCamelCase = camelcase answers.pkgName

> Generate package

      pump [
        gulp.src __dirname + '/templates/**'

        template answers

        rename (f) -> if f.basename[0] is '_' then f.basename = ".#{ f.basename.slice 1 }"

        conflict './'

        gulp.dest './'

        install()
      ]


## Version 1.1.5
## License [MIT](LICENSE)

[travis]: https://img.shields.io/travis/nhz-io/nhz-io-slush-um.svg?style=flat
[npm]: https://img.shields.io/npm/v/@nhz.io/slush-um.svg?style=flat

[coffeescript 2]: https://github.com/jashkenas/coffeescript
[coffeelint]: https://github.com/clutchski/coffeelint
[coffeetape]: https://github.com/nhz-io/coffeetape
[faucet]: https://github.com/substack/faucet
[tape-async]: https://github.com/parro-it/tape-async
[chokidar-cli]: https://github.com/kimmobrunfeldt/chokidar-cli
[husky]: https://github.com/typicode/husky
npm package: @nhz.io/travis-scoped-publish
Description: Publishing scoped modules with public assess from travis
Author: Ishi Ruy
Latest version: 0.0.3

# @nhz.io/travis-scoped-publish

<p align="center">
  <a href="https://npmjs.org/package/@nhz.io/travis-scoped-publish">
    <img src="https://img.shields.io/npm/v/@nhz.io/travis-scoped-publish.svg?style=flat"
         alt="NPM Version">
  </a>
  
  <a href="https://travis-ci.org/nhz-io/travis-scoped-publish">
    <img src="https://img.shields.io/travis/nhz-io/travis-scoped-publish.svg?style=flat"
         alt="Travis Build">
  </a>

  <a href="https://github.com/nhz-io/travis-scoped-publish/blob/master/LICENSE">
    <img src="https://img.shields.io/github/license/nhz-io/travis-scoped-publish.svg?style=flat"
         alt="License">
  </a>
</p>
<p align="center">
    <h3 align="center">Publishing scoped modules with public assess from travis</h3>
</p>

## Configure travis
Set **NPM_AUTH_TOKEN** repository variable in travis to your npm auth token (from `~/.npmrc`)

## Modify the .travis.yml below to your needs
```yml
language: node_js

deploy:
  - provider: script
    script: echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc 2>/dev/null
    on:
      tags: true

  - provider: script
    script: npm publish --access public
    on:
      tags: true
```

## License [MIT](LICENSE)