Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pouchdb-mapreduce-utils

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pouchdb-mapreduce-utils - npm Package Compare versions

Comparing version 6.1.0 to 6.1.1

51

lib/index.js

@@ -9,4 +9,5 @@ 'use strict';

var pouchdbUtils = require('pouchdb-utils');
var pouchdbCollections = require('pouchdb-collections');
var promisedCallback = function (promise, callback) {
function promisedCallback(promise, callback) {
if (callback) {

@@ -24,5 +25,5 @@ promise.then(function (res) {

return promise;
};
}
var callbackify = function (fun) {
function callbackify(fun) {
return argsarray(function (args) {

@@ -36,6 +37,6 @@ var cb = args.pop();

});
};
}
// Promise finally util similar to Q.finally
var fin = function (promise, finalPromiseFactory) {
function fin(promise, finalPromiseFactory) {
return promise.then(function (res) {

@@ -50,5 +51,5 @@ return finalPromiseFactory().then(function () {

});
};
}
var sequentialize = function (queue, promiseFactory) {
function sequentialize(queue, promiseFactory) {
return function () {

@@ -61,22 +62,25 @@ var args = arguments;

};
};
}
// uniq an array of strings, order not guaranteed
// similar to underscore/lodash _.uniq
var uniq = function (arr) {
var map = {};
function uniq(arr) {
var theSet = new pouchdbCollections.Set(arr);
var result = new Array(theSet.size);
var index = -1;
theSet.forEach(function (value) {
result[++index] = value;
});
return result;
}
for (var i = 0, len = arr.length; i < len; i++) {
map['$' + arr[i]] = true;
}
function mapToKeysArray(map) {
var result = new Array(map.size);
var index = -1;
map.forEach(function (value, key) {
result[++index] = key;
});
return result;
}
var keys = Object.keys(map);
var output = new Array(keys.length);
for (i = 0, len = keys.length; i < len; i++) {
output[i] = keys[i].substring(1);
}
return output;
};
exports.uniq = uniq;

@@ -86,2 +90,3 @@ exports.sequentialize = sequentialize;

exports.callbackify = callbackify;
exports.promisedCallback = promisedCallback;
exports.promisedCallback = promisedCallback;
exports.mapToKeysArray = mapToKeysArray;
{
"name": "pouchdb-mapreduce-utils",
"version": "6.1.0",
"version": "6.1.1",
"description": "PouchDB utilities used by pouchdb-mapreduce.",

@@ -17,4 +17,5 @@ "main": "./lib/index.js",

"argsarray": "0.0.1",
"pouchdb-utils": "6.1.0"
"pouchdb-collections": "6.1.1",
"pouchdb-utils": "6.1.1"
}
}
import argsarray from 'argsarray';
import { nextTick } from 'pouchdb-utils';
import { Set } from 'pouchdb-collections';
var promisedCallback = function (promise, callback) {
function promisedCallback(promise, callback) {
if (callback) {

@@ -17,5 +18,5 @@ promise.then(function (res) {

return promise;
};
}
var callbackify = function (fun) {
function callbackify(fun) {
return argsarray(function (args) {

@@ -29,6 +30,6 @@ var cb = args.pop();

});
};
}
// Promise finally util similar to Q.finally
var fin = function (promise, finalPromiseFactory) {
function fin(promise, finalPromiseFactory) {
return promise.then(function (res) {

@@ -43,5 +44,5 @@ return finalPromiseFactory().then(function () {

});
};
}
var sequentialize = function (queue, promiseFactory) {
function sequentialize(queue, promiseFactory) {
return function () {

@@ -54,22 +55,25 @@ var args = arguments;

};
};
}
// uniq an array of strings, order not guaranteed
// similar to underscore/lodash _.uniq
var uniq = function (arr) {
var map = {};
function uniq(arr) {
var theSet = new Set(arr);
var result = new Array(theSet.size);
var index = -1;
theSet.forEach(function (value) {
result[++index] = value;
});
return result;
}
for (var i = 0, len = arr.length; i < len; i++) {
map['$' + arr[i]] = true;
}
function mapToKeysArray(map) {
var result = new Array(map.size);
var index = -1;
map.forEach(function (value, key) {
result[++index] = key;
});
return result;
}
var keys = Object.keys(map);
var output = new Array(keys.length);
for (i = 0, len = keys.length; i < len; i++) {
output[i] = keys[i].substring(1);
}
return output;
};
export {

@@ -80,3 +84,4 @@ uniq,

callbackify,
promisedCallback
promisedCallback,
mapToKeysArray
};
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