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

providence

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

providence - npm Package Compare versions

Comparing version 0.5.2 to 0.6.0

70

modules/index.js

@@ -41,2 +41,4 @@ /**

var DELETEIN_PATH = ['deleteIn'];
var FOREACH_PATH = ['forEach'];
var REDUCE_PATH = ['reduce'];
var ONUPDATE_PATH = ['onUpdate'];

@@ -50,3 +52,3 @@ // Internal _onUpdate function; useful for when Providence is inherited.

// to be used to set on the key path in the case that there is no value set in the key path.
var DEFAULTS = [[UNBOXER_PATH, IDENTITY], [BOXER_PATH, IDENTITY], [PATH_PATH, INITIAL_PATH], [GETIN_PATH, _defaultGetIn], [SETIN_PATH, _defaultSetIn], [DELETEIN_PATH, _defaultDeleteIn]];
var DEFAULTS = [[UNBOXER_PATH, IDENTITY], [BOXER_PATH, IDENTITY], [PATH_PATH, INITIAL_PATH], [GETIN_PATH, _default.bind(null, 'getIn')], [SETIN_PATH, _default.bind(null, 'setIn')], [DELETEIN_PATH, _default.bind(null, 'deleteIn')], [FOREACH_PATH, _default.bind(null, 'forEach')], [REDUCE_PATH, _default.bind(null, 'reduce')]];
var PATH = 0;

@@ -344,2 +346,56 @@ var VALUE = 1;

Providence.prototype.forEach = function (sideEffect) {
var _this = this;
for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
rest[_key - 1] = arguments[_key];
}
var state = this.deref(NOT_SET);
if (state === NOT_SET) {
return;
}
var fetchForEach = this._options.getIn(FOREACH_PATH);
var forEach = fetchForEach(state);
var wrapped = function wrapped(value, key) {
for (var _len2 = arguments.length, _rest = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
_rest[_key2 - 2] = arguments[_key2];
}
var cursor = _this.cursor(key);
return sideEffect.call.apply(sideEffect, [sideEffect, cursor, key].concat(_rest));
};
return forEach.apply(undefined, [wrapped].concat(rest));
};
Providence.prototype.reduce = function (reducer) {
var _this2 = this;
for (var _len3 = arguments.length, rest = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
rest[_key3 - 1] = arguments[_key3];
}
var state = this.deref(NOT_SET);
if (state === NOT_SET) {
return;
}
var fetchReduce = this._options.getIn(REDUCE_PATH);
var reduce = fetchReduce(state);
var wrapped = function wrapped(accumulator, value, key) {
for (var _len4 = arguments.length, _rest = Array(_len4 > 3 ? _len4 - 3 : 0), _key4 = 3; _key4 < _len4; _key4++) {
_rest[_key4 - 3] = arguments[_key4];
}
var cursor = _this2.cursor(key);
return reducer.call.apply(reducer, [reducer, accumulator, cursor, key].concat(_rest));
};
return reduce.apply(undefined, [wrapped].concat(rest));
};
Providence.prototype.unboxRootData = function () {

@@ -487,12 +543,4 @@ var options = this._options;

function _defaultGetIn(rootData) {
return rootData.getIn.bind(rootData);
}
function _defaultSetIn(rootData) {
return rootData.setIn.bind(rootData);
}
function _defaultDeleteIn(rootData) {
return rootData.deleteIn.bind(rootData);
function _default(method, rootData) {
return rootData[method].bind(rootData);
}

8

package.json
{
"name": "providence",
"version": "0.5.2",
"version": "0.6.0",
"description": "Reference a sub-structure of any data structure",

@@ -33,3 +33,3 @@ "main": "modules/index.js",

"devDependencies": {
"babel": "^5.4.4",
"babel": "^5.4.7",
"chai": "^2.3.0",

@@ -40,6 +40,6 @@ "mocha": "^2.2.5"

"lodash.get": "^3.7.0",
"lodash.has": "^3.2.0",
"lodash.has": "^3.2.1",
"lodash.isplainobject": "^3.1.0",
"lodash.set": "^3.7.2"
"lodash.set": "^3.7.4"
}
}
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