Socket
Socket
Sign inDemoInstall

pouchdb-utils

Package Overview
Dependencies
Maintainers
0
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pouchdb-utils - npm Package Compare versions

Comparing version 8.0.1 to 9.0.0

103

lib/index-browser.es.js

@@ -1,6 +0,3 @@

import { Map } from 'pouchdb-collections';
import immediate from 'immediate';
import { createError, BAD_REQUEST, INVALID_ID, MISSING_ID, RESERVED_ID } from 'pouchdb-errors';
import EventEmitter from 'events';
import { assign } from 'pouchdb-utils';
import { v4 } from 'uuid';

@@ -14,26 +11,11 @@ import { stringMd5 } from 'pouchdb-md5';

function cloneArrayBuffer(buff) {
if (typeof buff.slice === 'function') {
return buff.slice(0);
}
// IE10-11 slice() polyfill
var target = new ArrayBuffer(buff.byteLength);
var targetArray = new Uint8Array(target);
var sourceArray = new Uint8Array(buff);
targetArray.set(sourceArray);
return target;
}
/**
* @template {ArrayBuffer | Blob} T
* @param {T} object
* @returns {T}
*/
function cloneBinaryObject(object) {
if (object instanceof ArrayBuffer) {
return cloneArrayBuffer(object);
}
var size = object.size;
var type = object.type;
// Blob
if (typeof object.slice === 'function') {
return object.slice(0, size, type);
}
// PhantomJS slice() replacement
return object.webkitSlice(0, size, type);
return object instanceof ArrayBuffer
? object.slice(0)
: object.slice(0, object.size, object.type);
}

@@ -258,3 +240,3 @@

});
callback(null, {results: results});
callback(null, {results});
}

@@ -269,3 +251,3 @@

function gotResult(docIndex, id, docs) {
perDocResults[docIndex] = {id: id, docs: docs};
perDocResults[docIndex] = {id, docs};
checkDone();

@@ -361,3 +343,7 @@ }

// Custom nextTick() shim for browsers. In node, this will just be process.nextTick(). We
const nextTick = typeof queueMicrotask === "function"
? queueMicrotask
: function nextTick(fn) {
Promise.resolve().then(fn);
};

@@ -367,5 +353,5 @@ class Changes extends EventEmitter {

super();
this._listeners = {};
if (hasLocalStorage()) {

@@ -397,7 +383,7 @@ addEventListener("storage", (e) => {

]);
function onError() {
inprogress = false;
}
db.changes(changesOpts).on('change', function (c) {

@@ -410,3 +396,3 @@ if (c.seq > opts.since && !opts.cancelled) {

if (inprogress === 'waiting') {
immediate(eventFunction);
nextTick(eventFunction);
}

@@ -419,3 +405,3 @@ inprogress = false;

}
removeListener(dbName, id) {

@@ -428,3 +414,3 @@ if (!(id in this._listeners)) {

}
notifyLocalWindows(dbName) {

@@ -437,3 +423,3 @@ //do a useless change on a storage thing

}
notify(dbName) {

@@ -487,31 +473,2 @@ this.emit(dbName);

var assign$1;
{
if (typeof Object.assign === 'function') {
assign$1 = Object.assign;
} else {
// lite Object.assign polyfill based on
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
assign$1 = function (target) {
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
};
}
}
var assign$2 = assign$1;
function tryFilter(filter, doc, req) {

@@ -562,10 +519,2 @@ try {

function flatten(arrs) {
var res = [];
for (var i = 0, len = arrs.length; i < len; i++) {
res = res.concat(arrs[i]);
}
return res;
}
// shim for Function.prototype.name,

@@ -580,3 +529,3 @@ // for browsers that don't support it like IE

// We dont run coverage in IE
// We don't run coverage in IE
/* istanbul ignore else */

@@ -767,3 +716,3 @@ if (hasName) {

var mutateableDoc = assign({}, doc);
var mutateableDoc = Object.assign({}, doc);
delete mutateableDoc._rev_tree;

@@ -775,2 +724,2 @@ return stringMd5(JSON.stringify(mutateableDoc));

export { adapterFun, assign$2 as assign, bulkGet as bulkGetShim, Changes as changesHandler, clone, defaultBackOff, explainError, filterChange, flatten, res$1 as functionName, guardedConsole, hasLocalStorage, invalidIdError, isRemote, listenerCount, immediate as nextTick, normalizeDesignDocFunctionName as normalizeDdocFunctionName, once, parseDesignDocFunctionName as parseDdocFunctionName, parseUri, pick, rev, scopeEval, toPromise, upsert, uuid };
export { adapterFun, bulkGet as bulkGetShim, Changes as changesHandler, clone, defaultBackOff, explainError, filterChange, res$1 as functionName, guardedConsole, hasLocalStorage, invalidIdError, isRemote, listenerCount, nextTick, normalizeDesignDocFunctionName as normalizeDdocFunctionName, once, parseDesignDocFunctionName as parseDdocFunctionName, parseUri, pick, rev, scopeEval, toPromise, upsert, uuid };

@@ -7,7 +7,4 @@ 'use strict';

var pouchdbCollections = require('pouchdb-collections');
var immediate = _interopDefault(require('immediate'));
var pouchdbErrors = require('pouchdb-errors');
var EventEmitter = _interopDefault(require('events'));
var pouchdbUtils = require('pouchdb-utils');
var uuid = require('uuid');

@@ -21,26 +18,11 @@ var pouchdbMd5 = require('pouchdb-md5');

function cloneArrayBuffer(buff) {
if (typeof buff.slice === 'function') {
return buff.slice(0);
}
// IE10-11 slice() polyfill
var target = new ArrayBuffer(buff.byteLength);
var targetArray = new Uint8Array(target);
var sourceArray = new Uint8Array(buff);
targetArray.set(sourceArray);
return target;
}
/**
* @template {ArrayBuffer | Blob} T
* @param {T} object
* @returns {T}
*/
function cloneBinaryObject(object) {
if (object instanceof ArrayBuffer) {
return cloneArrayBuffer(object);
}
var size = object.size;
var type = object.type;
// Blob
if (typeof object.slice === 'function') {
return object.slice(0, size, type);
}
// PhantomJS slice() replacement
return object.webkitSlice(0, size, type);
return object instanceof ArrayBuffer
? object.slice(0)
: object.slice(0, object.size, object.type);
}

@@ -242,3 +224,3 @@

// consolidate into one request per doc if possible
var requestsById = new pouchdbCollections.Map();
var requestsById = new Map();
requests.forEach(function (request) {

@@ -266,3 +248,3 @@ if (requestsById.has(request.id)) {

});
callback(null, {results: results});
callback(null, {results});
}

@@ -277,3 +259,3 @@

function gotResult(docIndex, id, docs) {
perDocResults[docIndex] = {id: id, docs: docs};
perDocResults[docIndex] = {id, docs};
checkDone();

@@ -369,3 +351,7 @@ }

// Custom nextTick() shim for browsers. In node, this will just be process.nextTick(). We
const nextTick = typeof queueMicrotask === "function"
? queueMicrotask
: function nextTick(fn) {
Promise.resolve().then(fn);
};

@@ -375,5 +361,5 @@ class Changes extends EventEmitter {

super();
this._listeners = {};
if (hasLocalStorage()) {

@@ -405,7 +391,7 @@ addEventListener("storage", (e) => {

]);
function onError() {
inprogress = false;
}
db.changes(changesOpts).on('change', function (c) {

@@ -418,3 +404,3 @@ if (c.seq > opts.since && !opts.cancelled) {

if (inprogress === 'waiting') {
immediate(eventFunction);
nextTick(eventFunction);
}

@@ -427,3 +413,3 @@ inprogress = false;

}
removeListener(dbName, id) {

@@ -436,3 +422,3 @@ if (!(id in this._listeners)) {

}
notifyLocalWindows(dbName) {

@@ -445,3 +431,3 @@ //do a useless change on a storage thing

}
notify(dbName) {

@@ -495,31 +481,2 @@ this.emit(dbName);

var assign;
{
if (typeof Object.assign === 'function') {
assign = Object.assign;
} else {
// lite Object.assign polyfill based on
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
assign = function (target) {
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
};
}
}
var assign$1 = assign;
function tryFilter(filter, doc, req) {

@@ -570,10 +527,2 @@ try {

function flatten(arrs) {
var res = [];
for (var i = 0, len = arrs.length; i < len; i++) {
res = res.concat(arrs[i]);
}
return res;
}
// shim for Function.prototype.name,

@@ -588,3 +537,3 @@ // for browsers that don't support it like IE

// We dont run coverage in IE
// We don't run coverage in IE
/* istanbul ignore else */

@@ -775,3 +724,3 @@ if (hasName) {

var mutateableDoc = pouchdbUtils.assign({}, doc);
var mutateableDoc = Object.assign({}, doc);
delete mutateableDoc._rev_tree;

@@ -784,3 +733,2 @@ return pouchdbMd5.stringMd5(JSON.stringify(mutateableDoc));

exports.adapterFun = adapterFun;
exports.assign = assign$1;
exports.bulkGetShim = bulkGet;

@@ -792,3 +740,2 @@ exports.changesHandler = Changes;

exports.filterChange = filterChange;
exports.flatten = flatten;
exports.functionName = res$1;

@@ -800,3 +747,3 @@ exports.guardedConsole = guardedConsole;

exports.listenerCount = listenerCount;
exports.nextTick = immediate;
exports.nextTick = nextTick;
exports.normalizeDdocFunctionName = normalizeDesignDocFunctionName;

@@ -803,0 +750,0 @@ exports.once = once;

@@ -1,6 +0,3 @@

import cloneBuffer from 'clone-buffer';
import { Map } from 'pouchdb-collections';
import { createError, BAD_REQUEST, INVALID_ID, MISSING_ID, RESERVED_ID } from 'pouchdb-errors';
import EventEmitter from 'events';
import { assign } from 'pouchdb-utils';
import { v4 } from 'uuid';

@@ -13,2 +10,4 @@ import { stringMd5 } from 'pouchdb-md5';

var cloneBinaryObject = (buffer) => Buffer.from(buffer);
// most of this is borrowed from lodash.isPlainObject:

@@ -56,3 +55,3 @@ // https://github.com/fis-components/lodash.isplainobject/

if (isBinaryObject(object)) {
return cloneBuffer(object);
return cloneBinaryObject(object);
}

@@ -232,3 +231,3 @@

});
callback(null, {results: results});
callback(null, {results});
}

@@ -243,3 +242,3 @@

function gotResult(docIndex, id, docs) {
perDocResults[docIndex] = {id: id, docs: docs};
perDocResults[docIndex] = {id, docs};
checkDone();

@@ -327,5 +326,7 @@ }

function nextTick(fn) {
process.nextTick(fn);
}
const nextTick = typeof queueMicrotask === "function"
? queueMicrotask
: function nextTick(fn) {
Promise.resolve().then(fn);
};

@@ -335,5 +336,5 @@ class Changes extends EventEmitter {

super();
this._listeners = {};
if (hasLocalStorage()) {

@@ -365,7 +366,7 @@ addEventListener("storage", (e) => {

]);
function onError() {
inprogress = false;
}
db.changes(changesOpts).on('change', function (c) {

@@ -386,3 +387,3 @@ if (c.seq > opts.since && !opts.cancelled) {

}
removeListener(dbName, id) {

@@ -395,3 +396,3 @@ if (!(id in this._listeners)) {

}
notifyLocalWindows(dbName) {

@@ -404,3 +405,3 @@ //do a useless change on a storage thing

}
notify(dbName) {

@@ -451,31 +452,2 @@ this.emit(dbName);

var assign$1;
{
if (typeof Object.assign === 'function') {
assign$1 = Object.assign;
} else {
// lite Object.assign polyfill based on
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
assign$1 = function (target) {
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
};
}
}
var assign$2 = assign$1;
function tryFilter(filter, doc, req) {

@@ -526,10 +498,2 @@ try {

function flatten(arrs) {
var res = [];
for (var i = 0, len = arrs.length; i < len; i++) {
res = res.concat(arrs[i]);
}
return res;
}
// shim for Function.prototype.name,

@@ -544,3 +508,3 @@ // for browsers that don't support it like IE

// We dont run coverage in IE
// We don't run coverage in IE
/* istanbul ignore else */

@@ -731,3 +695,3 @@ if (hasName) {

var mutateableDoc = assign({}, doc);
var mutateableDoc = Object.assign({}, doc);
delete mutateableDoc._rev_tree;

@@ -739,2 +703,2 @@ return stringMd5(JSON.stringify(mutateableDoc));

export { adapterFun, assign$2 as assign, bulkGet as bulkGetShim, Changes as changesHandler, clone, defaultBackOff, res as explainError, filterChange, flatten, res$2 as functionName, guardedConsole, hasLocalStorage, invalidIdError, isRemote, listenerCount, nextTick, normalizeDesignDocFunctionName as normalizeDdocFunctionName, once, parseDesignDocFunctionName as parseDdocFunctionName, parseUri, pick, rev, scopeEval, toPromise, upsert, uuid };
export { adapterFun, bulkGet as bulkGetShim, Changes as changesHandler, clone, defaultBackOff, res as explainError, filterChange, res$2 as functionName, guardedConsole, hasLocalStorage, invalidIdError, isRemote, listenerCount, nextTick, normalizeDesignDocFunctionName as normalizeDdocFunctionName, once, parseDesignDocFunctionName as parseDdocFunctionName, parseUri, pick, rev, scopeEval, toPromise, upsert, uuid };

@@ -7,7 +7,4 @@ 'use strict';

var cloneBuffer = _interopDefault(require('clone-buffer'));
var pouchdbCollections = require('pouchdb-collections');
var pouchdbErrors = require('pouchdb-errors');
var EventEmitter = _interopDefault(require('events'));
var pouchdbUtils = require('pouchdb-utils');
var uuid = require('uuid');

@@ -20,2 +17,4 @@ var pouchdbMd5 = require('pouchdb-md5');

var cloneBinaryObject = (buffer) => Buffer.from(buffer);
// most of this is borrowed from lodash.isPlainObject:

@@ -63,3 +62,3 @@ // https://github.com/fis-components/lodash.isplainobject/

if (isBinaryObject(object)) {
return cloneBuffer(object);
return cloneBinaryObject(object);
}

@@ -216,3 +215,3 @@

// consolidate into one request per doc if possible
var requestsById = new pouchdbCollections.Map();
var requestsById = new Map();
requests.forEach(function (request) {

@@ -240,3 +239,3 @@ if (requestsById.has(request.id)) {

});
callback(null, {results: results});
callback(null, {results});
}

@@ -251,3 +250,3 @@

function gotResult(docIndex, id, docs) {
perDocResults[docIndex] = {id: id, docs: docs};
perDocResults[docIndex] = {id, docs};
checkDone();

@@ -335,5 +334,7 @@ }

function nextTick(fn) {
process.nextTick(fn);
}
const nextTick = typeof queueMicrotask === "function"
? queueMicrotask
: function nextTick(fn) {
Promise.resolve().then(fn);
};

@@ -343,5 +344,5 @@ class Changes extends EventEmitter {

super();
this._listeners = {};
if (hasLocalStorage()) {

@@ -373,7 +374,7 @@ addEventListener("storage", (e) => {

]);
function onError() {
inprogress = false;
}
db.changes(changesOpts).on('change', function (c) {

@@ -394,3 +395,3 @@ if (c.seq > opts.since && !opts.cancelled) {

}
removeListener(dbName, id) {

@@ -403,3 +404,3 @@ if (!(id in this._listeners)) {

}
notifyLocalWindows(dbName) {

@@ -412,3 +413,3 @@ //do a useless change on a storage thing

}
notify(dbName) {

@@ -459,31 +460,2 @@ this.emit(dbName);

var assign;
{
if (typeof Object.assign === 'function') {
assign = Object.assign;
} else {
// lite Object.assign polyfill based on
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
assign = function (target) {
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) { // Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
};
}
}
var assign$1 = assign;
function tryFilter(filter, doc, req) {

@@ -534,10 +506,2 @@ try {

function flatten(arrs) {
var res = [];
for (var i = 0, len = arrs.length; i < len; i++) {
res = res.concat(arrs[i]);
}
return res;
}
// shim for Function.prototype.name,

@@ -552,3 +516,3 @@ // for browsers that don't support it like IE

// We dont run coverage in IE
// We don't run coverage in IE
/* istanbul ignore else */

@@ -739,3 +703,3 @@ if (hasName) {

var mutateableDoc = pouchdbUtils.assign({}, doc);
var mutateableDoc = Object.assign({}, doc);
delete mutateableDoc._rev_tree;

@@ -748,3 +712,2 @@ return pouchdbMd5.stringMd5(JSON.stringify(mutateableDoc));

exports.adapterFun = adapterFun;
exports.assign = assign$1;
exports.bulkGetShim = bulkGet;

@@ -756,3 +719,2 @@ exports.changesHandler = Changes;

exports.filterChange = filterChange;
exports.flatten = flatten;
exports.functionName = res$2;

@@ -759,0 +721,0 @@ exports.guardedConsole = guardedConsole;

{
"name": "pouchdb-utils",
"version": "8.0.1",
"version": "9.0.0",
"description": "Unassorted utilities used by PouchDB.",

@@ -14,3 +14,3 @@ "main": "./lib/index.js",

},
"jsnext:main": "./lib/index.es.js",
"module": "./lib/index.es.js",
"browser": {

@@ -21,15 +21,10 @@ "./lib/index.js": "./lib/index-browser.js",

"dependencies": {
"clone-buffer": "1.0.0",
"immediate": "3.3.0",
"pouchdb-collections": "8.0.1",
"pouchdb-errors": "8.0.1",
"pouchdb-md5": "8.0.1",
"pouchdb-errors": "9.0.0",
"pouchdb-md5": "9.0.0",
"uuid": "8.3.2"
},
"module": "./lib/index.es.js",
"files": [
"lib",
"dist",
"tonic-example.js"
"dist"
]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc