How to use transform-pouch - 3 common examples

To help you get started, we’ve selected a few transform-pouch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jo / pouch-box / index.js View on Github external
views: {
    receivers: {
      map: function(doc) {
        if (typeof doc.box !== 'object') return
        if (typeof doc.box.receivers !== 'object') return

        for (var receiver in doc.box.receivers) {
          emit(receiver, null)
        }
      }.toString(),
      reduce: '_count'
    }
  }
}

exports.transform = require('transform-pouch').transform

exports.box = function(sessionKeyPair, receivers) {
  var db = this
  var mypermit = permit(sessionKeyPair)


  return db
    // setup design document
    .get(ddoc._id)
    .catch(function(err) {
      if (err.status === 404) {
        return db.put(ddoc)
      }
      
      return err
    })
github lil5 / simple-cryptor-pouch / src / index.js View on Github external
const SimpleCryptoJS = require('simple-crypto-js').default
const transform = require('transform-pouch').transform

const cryptor = require('./cryptor')

/**
 * pouch function to encrypt and decrypt
 * @param  {string} password
 * @param  {Object} [options={}]
 * @return {Object | Promise}
 */
function simplecryptor (password, options = {}) {
  const db = this

  // set default ignore
  options.ignore = ['_id', '_rev', '_deleted'].concat(options.ignore)

  const simpleCryptoJS = new SimpleCryptoJS(password)
github calvinmetcalf / crypto-pouch / index.js View on Github external
'use strict';
var pbkdf2 = require('native-crypto/pbkdf2');
var randomBytes = require('randombytes');
var configId = '_local/crypto';
var chachaHelper = require('./chacha');
var gcmHelper = require('./gcm');
var defaultDigest = 'sha256';
var defaultIterations = 100000;
var previousIterations = 1000;
var defaultAlgo = 'aes-gcm';
var transform = require('transform-pouch').transform;
var uuid = require('uuid');
function noop(){}
function cryptoInit(password, options) {
  var db = this;
  var key, cb;
  var turnedOff = false;
  var ignore = ['_id', '_rev', '_deleted']
  if (!options) {
    options = {};
  }
  var algo;
  if (password && typeof password === 'object') {
    options = password;
    password = password.password;
    delete options.password;
  }

transform-pouch

Transform Pouch - a PouchDB plugin for transforming documents

Apache-2.0
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Popular transform-pouch functions