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

dot-store

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot-store - npm Package Compare versions

Comparing version 2.6.5 to 2.6.8

135

dist/changed.js

@@ -11,2 +11,5 @@ "use strict";

exports.changeListener = changeListener;
exports.changedMatch = changedMatch;
exports.changedVars = changedVars;
exports.changedValueVars = changedValueVars;
exports.varPropRegex = void 0;

@@ -49,2 +52,43 @@

function changed(matcher, options) {
var _changedVars = changedVars({
matcher: matcher,
options: options
}),
matchProps = _changedVars.matchProps,
vars = _changedVars.vars;
if (vars) {
return changedMatch({
matchProps: matchProps,
options: options,
vars: vars
});
} else {
return false;
}
}
function changeListener(_ref) {
var listener = _ref.listener,
prop = _ref.prop;
return function (options) {
var _changedValueVars = changedValueVars({
options: options,
prop: prop
}),
value = _changedValueVars.value,
vars = _changedValueVars.vars;
if (vars) {
return listener((0, _objectSpread2.default)({}, options, vars, {
value: value
}));
}
};
}
function changedMatch(_ref2) {
var matchProps = _ref2.matchProps,
options = _ref2.options,
vars = _ref2.vars;
var op = options.op,

@@ -56,2 +100,28 @@ prevState = options.prevState,

if (!prevState) {
var _current = _dotPropImmutable.default.get(state, props);
if (op === "get" || _current != value) {
return vars;
}
return false;
}
var current = _dotPropImmutable.default.get(state, matchProps);
var previous = _dotPropImmutable.default.get(prevState, matchProps);
if (current != previous) {
return vars;
}
return false;
}
function changedVars(_ref3) {
var matcher = _ref3.matcher,
options = _ref3.options;
var props = options.props;
var matchProps = _dotPropImmutable.default.propToArray(matcher);

@@ -67,8 +137,8 @@

for (var _iterator = (0, _getIterator2.default)(entries), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _ref3 = _step.value;
var _ref6 = _step.value;
var _ref2 = (0, _slicedToArray2.default)(_ref3, 2);
var _ref5 = (0, _slicedToArray2.default)(_ref6, 2);
var _index = _ref2[0];
var _matchProp = _ref2[1];
var _index = _ref5[0];
var _matchProp = _ref5[1];
var prop = props[_index];

@@ -82,3 +152,5 @@

if (mismatch || needProp) {
return false;
return {
vars: false
};
}

@@ -106,35 +178,36 @@

if (!prevState) {
var _current = _dotPropImmutable.default.get(state, props);
return {
matchProps: matchProps,
vars: vars
};
}
if (op === "get" || _current != value) {
return vars;
}
function changedValueVars(_ref7) {
var options = _ref7.options,
prop = _ref7.prop;
var state = options.state;
return false;
if (!prop) {
return {
value: state,
vars: {}
};
}
var current = _dotPropImmutable.default.get(state, matchProps);
var _changedVars2 = changedVars({
matcher: prop,
options: options
}),
matchProps = _changedVars2.matchProps,
vars = _changedVars2.vars;
var previous = _dotPropImmutable.default.get(prevState, matchProps);
if (current != previous) {
return vars;
}
return false;
}
function changeListener(_ref4) {
var listener = _ref4.listener,
prop = _ref4.prop;
return function (options) {
var changed = options.changed;
var vars = changed(prop);
if (vars) {
return listener((0, _objectSpread2.default)({}, options, vars));
}
return {
value: _dotPropImmutable.default.get(state, matchProps),
vars: changedMatch({
matchProps: matchProps,
options: options,
vars: vars
})
};
}
//# sourceMappingURL=changed.js.map

@@ -128,3 +128,3 @@ "use strict";

_regenerator.default.mark(function _callee2(_ref2) {
var meta, op, prop, value, props, prev, payload, state, prevState;
var meta, op, prop, value, props, prev, beforePayload, state, prevState, afterPayload;
return _regenerator.default.wrap(function _callee2$(_context2) {

@@ -137,3 +137,3 @@ while (1) {

prev = this.getSync(prop);
payload = {
beforePayload = {
changed: (0, _changed.buildChanged)({

@@ -154,3 +154,3 @@ op: op,

_context2.next = 6;
return this.emitOp("before", payload);
return this.emitOp("before", beforePayload);

@@ -165,3 +165,3 @@ case 6:

payload = (0, _objectSpread2.default)({}, payload, {
afterPayload = (0, _objectSpread2.default)({}, beforePayload, {
changed: (0, _changed.buildChanged)({

@@ -176,3 +176,3 @@ op: op,

_context2.next = 12;
return this.emitOp("after", payload);
return this.emitOp("after", afterPayload);

@@ -312,11 +312,6 @@ case 12:

listener = _parseArgs2[2];
if (prop) {
return (0, _get2.default)(DotStore.prototype.__proto__ || (0, _getPrototypeOf.default)(DotStore.prototype), "on", this).call(this, event, (0, _changed.changeListener)({
listener: listener,
prop: prop
}));
} else {
return (0, _get2.default)(DotStore.prototype.__proto__ || (0, _getPrototypeOf.default)(DotStore.prototype), "on", this).call(this, event, listener);
}
return (0, _get2.default)(DotStore.prototype.__proto__ || (0, _getPrototypeOf.default)(DotStore.prototype), "on", this).call(this, event, (0, _changed.changeListener)({
listener: listener,
prop: prop
}));
}

@@ -342,8 +337,2 @@ }, {

prop = _parseArgs4[1];
if (!prop) {
_context4.next = 7;
break;
}
return _context4.abrupt("return", new _promise.default(function (resolve) {

@@ -356,10 +345,3 @@ var unsub = _this2.on(event, prop, function (options) {

case 7:
_context4.next = 9;
return (0, _get2.default)(DotStore.prototype.__proto__ || (0, _getPrototypeOf.default)(DotStore.prototype), "once", this).call(this, event);
case 9:
return _context4.abrupt("return", _context4.sent);
case 10:
case 6:
case "end":

@@ -366,0 +348,0 @@ return _context4.stop();

{
"name": "dot-store",
"version": "2.6.5",
"version": "2.6.8",
"description": "Like Redux, but easy",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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