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.2.8 to 2.3.0

44

dist/changed.js
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.buildChanged = buildChanged;
exports.changed = changed;
var _slicedToArray2 = require("babel-runtime/helpers/slicedToArray");
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
var _getIterator2 = _interopRequireDefault(require("@babel/runtime/core-js/get-iterator"));
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _dotPropImmutable = _interopRequireDefault(require("dot-prop-immutable"));
var _extends2 = require("babel-runtime/helpers/extends");
var _extends3 = _interopRequireDefault(_extends2);
exports.buildChanged = buildChanged;
exports.changed = changed;
var _dotPropImmutable = require("dot-prop-immutable");
var _dotPropImmutable2 = _interopRequireDefault(_dotPropImmutable);
var _string = require("./string");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Packages
// Strings
function buildChanged(options) {
return function () {
for (var _len = arguments.length, matchers = Array(_len), _key = 0; _key < _len; _key++) {
for (var _len = arguments.length, matchers = new Array(_len), _key = 0; _key < _len; _key++) {
matchers[_key] = arguments[_key];

@@ -41,3 +33,3 @@ }

if (out) {
return (0, _extends3.default)({}, memo || {}, out);
return (0, _objectSpread2.default)({}, memo || {}, out);
} else {

@@ -50,3 +42,2 @@ return memo;

// Strings
function changed(matcher, options) {

@@ -56,6 +47,4 @@ var props = options.props,

state = options.state;
var matchProps = (0, _string.propToArray)(matcher);
var vars = {};
var _iteratorNormalCompletion = true;

@@ -66,4 +55,4 @@ var _didIteratorError = false;

try {
for (var _iterator = (0, _getIterator3.default)(matchProps.entries()), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _step$value = (0, _slicedToArray3.default)(_step.value, 2),
for (var _iterator = (0, _getIterator2.default)(matchProps.entries()), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
index = _step$value[0],

@@ -87,3 +76,3 @@ value = _step$value[1];

try {
if (!_iteratorNormalCompletion && _iterator.return) {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();

@@ -98,5 +87,6 @@ }

var current = _dotPropImmutable2.default.get(state, matchProps);
var previous = _dotPropImmutable2.default.get(prevState, matchProps);
var current = _dotPropImmutable.default.get(state, matchProps);
var previous = _dotPropImmutable.default.get(prevState, matchProps);
if (current != previous) {

@@ -103,0 +93,0 @@ return vars;

"use strict";
var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = require("babel-runtime/helpers/inherits");
var _getIterator2 = _interopRequireDefault(require("@babel/runtime/core-js/get-iterator"));
var _inherits3 = _interopRequireDefault(_inherits2);
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _regenerator = require("babel-runtime/regenerator");
var _map = _interopRequireDefault(require("@babel/runtime/core-js/map"));
var _regenerator2 = _interopRequireDefault(_regenerator);
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _toConsumableArray2 = require("babel-runtime/helpers/toConsumableArray");
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _set = _interopRequireDefault(require("@babel/runtime/core-js/set"));
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
var _promise = _interopRequireDefault(require("@babel/runtime/core-js/promise"));
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _weakMap = _interopRequireDefault(require("@babel/runtime/core-js/weak-map"));
var _map = require("babel-runtime/core-js/map");
var anyMap = new _weakMap.default();
var eventsMap = new _weakMap.default();
var _map2 = _interopRequireDefault(_map);
var resolvedPromise = _promise.default.resolve();
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require("babel-runtime/helpers/createClass");
var _createClass3 = _interopRequireDefault(_createClass2);
var _set = require("babel-runtime/core-js/set");
var _set2 = _interopRequireDefault(_set);
var _promise = require("babel-runtime/core-js/promise");
var _promise2 = _interopRequireDefault(_promise);
var _weakMap = require("babel-runtime/core-js/weak-map");
var _weakMap2 = _interopRequireDefault(_weakMap);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var anyMap = new _weakMap2.default();
var eventsMap = new _weakMap2.default();
var resolvedPromise = _promise2.default.resolve();
function assertEventName(eventName) {

@@ -75,4 +50,5 @@ if (typeof eventName !== "string") {

var events = eventsMap.get(instance);
if (!events.has(eventName)) {
events.set(eventName, new _set2.default());
events.set(eventName, new _set.default());
}

@@ -83,11 +59,12 @@

var Emittery = function () {
var Emittery =
/*#__PURE__*/
function () {
function Emittery() {
(0, _classCallCheck3.default)(this, Emittery);
anyMap.set(this, new _set2.default());
eventsMap.set(this, new _map2.default());
(0, _classCallCheck2.default)(this, Emittery);
anyMap.set(this, new _set.default());
eventsMap.set(this, new _map.default());
}
(0, _createClass3.default)(Emittery, [{
(0, _createClass2.default)(Emittery, [{
key: "on",

@@ -112,4 +89,5 @@ value: function on(eventName, listener) {

return new _promise2.default(function (resolve) {
return new _promise.default(function (resolve) {
assertEventName(eventName);
var off = _this.on(eventName, function (data) {

@@ -124,7 +102,7 @@ off();

value: function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(eventName, eventData) {
var _this2 = this;
var _emit = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee3(eventName, eventData) {
var listeners, anyListeners, staticListeners, staticAnyListeners;
return _regenerator2.default.wrap(function _callee3$(_context3) {
return _regenerator.default.wrap(function _callee3$(_context3) {
while (1) {

@@ -134,7 +112,6 @@ switch (_context3.prev = _context3.next) {

assertEventName(eventName);
listeners = getListeners(this, eventName);
anyListeners = anyMap.get(this);
staticListeners = [].concat((0, _toConsumableArray3.default)(listeners));
staticAnyListeners = [].concat((0, _toConsumableArray3.default)(anyListeners));
staticListeners = (0, _toConsumableArray2.default)(listeners);
staticAnyListeners = (0, _toConsumableArray2.default)(anyListeners);
_context3.next = 7;

@@ -144,5 +121,9 @@ return resolvedPromise;

case 7:
return _context3.abrupt("return", _promise2.default.all([].concat((0, _toConsumableArray3.default)(staticListeners.map(function () {
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(listener) {
return _regenerator2.default.wrap(function _callee$(_context) {
return _context3.abrupt("return", _promise.default.all((0, _toConsumableArray2.default)(staticListeners.map(
/*#__PURE__*/
function () {
var _ref = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee(listener) {
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {

@@ -163,11 +144,15 @@ switch (_context.prev = _context.next) {

}
}, _callee, _this2);
}, _callee, this);
}));
return function (_x3) {
return _ref2.apply(this, arguments);
return _ref.apply(this, arguments);
};
}())), (0, _toConsumableArray3.default)(staticAnyListeners.map(function () {
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(listener) {
return _regenerator2.default.wrap(function _callee2$(_context2) {
}())).concat((0, _toConsumableArray2.default)(staticAnyListeners.map(
/*#__PURE__*/
function () {
var _ref2 = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee2(listener) {
return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) {

@@ -188,7 +173,7 @@ switch (_context2.prev = _context2.next) {

}
}, _callee2, _this2);
}, _callee2, this);
}));
return function (_x4) {
return _ref3.apply(this, arguments);
return _ref2.apply(this, arguments);
};

@@ -205,7 +190,5 @@ }())))));

function emit(_x, _x2) {
return _ref.apply(this, arguments);
}
return emit;
return function emit(_x, _x2) {
return _emit.apply(this, arguments);
};
}()

@@ -215,6 +198,8 @@ }, {

value: function () {
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(eventName, eventData) {
var _emitSerial = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee4(eventName, eventData) {
var listeners, anyListeners, staticListeners, staticAnyListeners, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, listener, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _listener;
return _regenerator2.default.wrap(function _callee4$(_context4) {
return _regenerator.default.wrap(function _callee4$(_context4) {
while (1) {

@@ -224,7 +209,6 @@ switch (_context4.prev = _context4.next) {

assertEventName(eventName);
listeners = getListeners(this, eventName);
anyListeners = anyMap.get(this);
staticListeners = [].concat((0, _toConsumableArray3.default)(listeners));
staticAnyListeners = [].concat((0, _toConsumableArray3.default)(anyListeners));
staticListeners = (0, _toConsumableArray2.default)(listeners);
staticAnyListeners = (0, _toConsumableArray2.default)(anyListeners);
_context4.next = 7;

@@ -239,3 +223,3 @@ return resolvedPromise;

_context4.prev = 10;
_iterator = (0, _getIterator3.default)(staticListeners);
_iterator = (0, _getIterator2.default)(staticListeners);

@@ -277,3 +261,3 @@ case 12:

if (!_iteratorNormalCompletion && _iterator.return) {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();

@@ -303,3 +287,3 @@ }

_context4.prev = 37;
_iterator2 = (0, _getIterator3.default)(staticAnyListeners);
_iterator2 = (0, _getIterator2.default)(staticAnyListeners);

@@ -341,3 +325,3 @@ case 39:

if (!_iteratorNormalCompletion2 && _iterator2.return) {
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
_iterator2.return();

@@ -370,7 +354,5 @@ }

function emitSerial(_x5, _x6) {
return _ref4.apply(this, arguments);
}
return emitSerial;
return function emitSerial(_x5, _x6) {
return _emitSerial.apply(this, arguments);
};
}()

@@ -402,5 +384,4 @@ }, {

try {
for (var _iterator3 = (0, _getIterator3.default)(eventsMap.get(this).values()), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
for (var _iterator3 = (0, _getIterator2.default)(eventsMap.get(this).values()), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var listeners = _step3.value;
listeners.clear();

@@ -413,3 +394,3 @@ }

try {
if (!_iteratorNormalCompletion3 && _iterator3.return) {
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
_iterator3.return();

@@ -437,3 +418,2 @@ }

var count = anyMap.get(this).size;
var _iteratorNormalCompletion4 = true;

@@ -444,5 +424,4 @@ var _didIteratorError4 = false;

try {
for (var _iterator4 = (0, _getIterator3.default)(eventsMap.get(this).values()), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
for (var _iterator4 = (0, _getIterator2.default)(eventsMap.get(this).values()), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var value = _step4.value;
count += value.size;

@@ -455,3 +434,3 @@ }

try {
if (!_iteratorNormalCompletion4 && _iterator4.return) {
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
_iterator4.return();

@@ -470,17 +449,17 @@ }

return Emittery;
}();
}(); // Subclass used to encourage TS users to type their events.
// Subclass used to encourage TS users to type their events.
Emittery.Typed = function (_Emittery) {
(0, _inherits3.default)(_class, _Emittery);
Emittery.Typed =
/*#__PURE__*/
function (_Emittery) {
function _class() {
(0, _classCallCheck3.default)(this, _class);
return (0, _possibleConstructorReturn3.default)(this, (_class.__proto__ || (0, _getPrototypeOf2.default)(_class)).apply(this, arguments));
(0, _classCallCheck2.default)(this, _class);
return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(_class).apply(this, arguments));
}
(0, _inherits2.default)(_class, _Emittery);
return _class;
}(Emittery);
Object.defineProperty(Emittery.Typed, "Typed", {

@@ -490,4 +469,3 @@ enumerable: false,

});
module.exports = Emittery;
//# sourceMappingURL=emitter.js.map
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.opEventRegex = exports.ops = undefined;
exports.default = exports.opEventRegex = exports.ops = void 0;
var _extends2 = require("babel-runtime/helpers/extends");
var _getIterator2 = _interopRequireDefault(require("@babel/runtime/core-js/get-iterator"));
var _extends3 = _interopRequireDefault(_extends2);
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
var _regenerator = require("babel-runtime/regenerator");
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _regenerator2 = _interopRequireDefault(_regenerator);
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of");
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
var _dotPropImmutable = _interopRequireDefault(require("dot-prop-immutable"));
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _emitter = _interopRequireDefault(require("./emitter"));
var _createClass2 = require("babel-runtime/helpers/createClass");
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _get2 = require("babel-runtime/helpers/get");
var _get3 = _interopRequireDefault(_get2);
var _inherits2 = require("babel-runtime/helpers/inherits");
var _inherits3 = _interopRequireDefault(_inherits2);
var _dotPropImmutable = require("dot-prop-immutable");
var _dotPropImmutable2 = _interopRequireDefault(_dotPropImmutable);
var _emitter = require("./emitter");
var _emitter2 = _interopRequireDefault(_emitter);
var _changed = require("./changed");

@@ -60,72 +38,61 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var ops = ["delete", "get", "merge", "set", "toggle"];
exports.ops = ops;
var opEventRegex = /(before|after)(Delete|Get|Merge|Set|Toggle|Update)/;
exports.opEventRegex = opEventRegex;
var ops = exports.ops = ["delete", "get", "merge", "set", "toggle"];
var opEventRegex = exports.opEventRegex = /(before|after)(Delete|Get|Merge|Set|Toggle|Update)/;
var DotStore = function (_Emitter) {
(0, _inherits3.default)(DotStore, _Emitter);
var DotStore =
/*#__PURE__*/
function (_Emitter) {
function DotStore() {
var _this2 = this;
var _this;
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
(0, _classCallCheck3.default)(this, DotStore);
var _this = (0, _possibleConstructorReturn3.default)(this, (DotStore.__proto__ || (0, _getPrototypeOf2.default)(DotStore)).call(this));
(0, _classCallCheck2.default)(this, DotStore);
_this = (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(DotStore).call(this));
_this.state = state;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
var _loop = function _loop() {
var op = ops[_i];
try {
var _loop = function _loop() {
var op = _step.value;
_this[op] =
/*#__PURE__*/
function () {
var _ref = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee(prop, value) {
var meta,
_args = arguments;
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
meta = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
_context.next = 3;
return _this.store({
meta: meta,
op: op,
prop: prop,
value: value
});
_this[op] = function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(prop, value) {
var meta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return _this.store({ meta: meta, op: op, prop: prop, value: value });
case 3:
return _context.abrupt("return", _context.sent);
case 2:
return _context.abrupt("return", _context.sent);
case 3:
case "end":
return _context.stop();
}
case 4:
case "end":
return _context.stop();
}
}, _callee, _this2);
}));
}
}, _callee, this);
}));
return function (_x2, _x3) {
return _ref.apply(this, arguments);
};
}();
};
return function (_x, _x2) {
return _ref.apply(this, arguments);
};
}();
};
for (var _iterator = (0, _getIterator3.default)(ops), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
_loop();
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
for (var _i = 0; _i < ops.length; _i++) {
_loop();
}

@@ -136,6 +103,6 @@

(0, _createClass3.default)(DotStore, [{
(0, _createClass2.default)(DotStore, [{
key: "getSync",
value: function getSync(prop) {
return _dotPropImmutable2.default.get(this.state, prop);
return _dotPropImmutable.default.get(this.state, prop);
}

@@ -145,16 +112,17 @@ }, {

value: function () {
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(_ref3) {
var meta = _ref3.meta,
op = _ref3.op,
prop = _ref3.prop,
value = _ref3.value;
var props, prev, payload, result, prevState;
return _regenerator2.default.wrap(function _callee2$(_context2) {
var _store = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee2(_ref2) {
var meta, op, prop, value, props, prev, payload, result, prevState;
return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
meta = _ref2.meta, op = _ref2.op, prop = _ref2.prop, value = _ref2.value;
props = (0, _string.propToArray)(prop);
prev = this.getSync(prop);
payload = {
changed: (0, _changed.buildChanged)({ props: props }),
changed: (0, _changed.buildChanged)({
props: props
}),
meta: meta,

@@ -168,10 +136,9 @@ op: op,

};
_context2.next = 5;
_context2.next = 6;
return this.emitOp("before", payload);
case 5:
result = _dotPropImmutable2.default[op](this.state, prop, value);
case 6:
result = _dotPropImmutable.default[op](this.state, prop, value);
prevState = this.state;
if (op != "get") {

@@ -181,3 +148,3 @@ this.state = result;

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

@@ -190,9 +157,8 @@ prevState: prevState,

});
_context2.next = 11;
_context2.next = 12;
return this.emitOp("after", payload);
case 11:
case 12:
if (!(op == "get")) {
_context2.next = 15;
_context2.next = 16;
break;

@@ -203,6 +169,6 @@ }

case 15:
case 16:
return _context2.abrupt("return", this.state);
case 16:
case 17:
case "end":

@@ -215,7 +181,5 @@ return _context2.stop();

function store(_x5) {
return _ref2.apply(this, arguments);
}
return store;
return function store(_x3) {
return _store.apply(this, arguments);
};
}()

@@ -225,6 +189,8 @@ }, {

value: function () {
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(event, data) {
var events, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, e;
var _emitOp = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee3(event, data) {
var events, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, e;
return _regenerator2.default.wrap(function _callee3$(_context3) {
return _regenerator.default.wrap(function _callee3$(_context3) {
while (1) {

@@ -234,10 +200,10 @@ switch (_context3.prev = _context3.next) {

events = this.events(event, data);
_iteratorNormalCompletion2 = true;
_didIteratorError2 = false;
_iteratorError2 = undefined;
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context3.prev = 4;
_iterator2 = (0, _getIterator3.default)(events);
_iterator = (0, _getIterator2.default)(events);
case 6:
if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) {
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) {
_context3.next = 13;

@@ -247,5 +213,5 @@ break;

e = _step2.value;
e = _step.value;
_context3.next = 10;
return this.emitSerial(e, (0, _extends3.default)({}, data, {
return this.emitSerial(e, (0, _objectSpread2.default)({}, data, {
state: this.state

@@ -255,3 +221,3 @@ }));

case 10:
_iteratorNormalCompletion2 = true;
_iteratorNormalCompletion = true;
_context3.next = 6;

@@ -267,4 +233,4 @@ break;

_context3.t0 = _context3["catch"](4);
_didIteratorError2 = true;
_iteratorError2 = _context3.t0;
_didIteratorError = true;
_iteratorError = _context3.t0;

@@ -275,4 +241,4 @@ case 19:

if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}

@@ -283,3 +249,3 @@

if (!_didIteratorError2) {
if (!_didIteratorError) {
_context3.next = 25;

@@ -289,3 +255,3 @@ break;

throw _iteratorError2;
throw _iteratorError;

@@ -306,19 +272,16 @@ case 25:

function emitOp(_x6, _x7) {
return _ref4.apply(this, arguments);
}
return emitOp;
return function emitOp(_x4, _x5) {
return _emitOp.apply(this, arguments);
};
}()
}, {
key: "events",
value: function events(event, _ref5) {
var op = _ref5.op;
value: function events(event, _ref3) {
var op = _ref3.op;
var opEvent = "".concat(event).concat((0, _string.capitalize)(op));
var opEvent = "" + event + (0, _string.capitalize)(op);
if (op == "get") {
return [opEvent];
} else {
return [opEvent, event + "Update"];
return [opEvent, "".concat(event, "Update")];
}

@@ -330,15 +293,18 @@ }

if (!prop && !listener) {
;var _ref6 = ["afterUpdate", undefined, event];
;
var _ref4 = ["afterUpdate", undefined, event];
event = _ref4[0];
prop = _ref4[1];
listener = _ref4[2];
} else if (!listener && event.match(opEventRegex)) {
;
var _ref5 = [undefined, prop];
prop = _ref5[0];
listener = _ref5[1];
} else if (!listener) {
;
var _ref6 = ["afterUpdate", event, prop];
event = _ref6[0];
prop = _ref6[1];
listener = _ref6[2];
} else if (!listener && event.match(opEventRegex)) {
;var _ref7 = [undefined, prop];
prop = _ref7[0];
listener = _ref7[1];
} else if (!listener) {
;var _ref8 = ["afterUpdate", event, prop];
event = _ref8[0];
prop = _ref8[1];
listener = _ref8[2];
}

@@ -349,13 +315,12 @@

var changed = options.changed;
var vars = changed(prop);
if (vars) {
return listener((0, _extends3.default)({}, options, vars));
return listener((0, _objectSpread2.default)({}, options, vars));
}
};
return (0, _get3.default)(DotStore.prototype.__proto__ || (0, _getPrototypeOf2.default)(DotStore.prototype), "on", this).call(this, event, customListener);
return (0, _get2.default)((0, _getPrototypeOf2.default)(DotStore.prototype), "on", this).call(this, event, customListener);
} else {
return (0, _get3.default)(DotStore.prototype.__proto__ || (0, _getPrototypeOf2.default)(DotStore.prototype), "on", this).call(this, event, listener);
return (0, _get2.default)((0, _getPrototypeOf2.default)(DotStore.prototype), "on", this).call(this, event, listener);
}

@@ -366,6 +331,8 @@ }

value: function () {
var _ref9 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4(event, prop) {
var _ref10, options, changed, vars;
var _once = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee4(event, prop) {
var _ref7, options, changed, vars;
return _regenerator2.default.wrap(function _callee4$(_context4) {
return _regenerator.default.wrap(function _callee4$(_context4) {
while (1) {

@@ -375,5 +342,6 @@ switch (_context4.prev = _context4.next) {

if (!prop && !event.match(opEventRegex)) {
;_ref10 = ["afterUpdate", event];
event = _ref10[0];
prop = _ref10[1];
;
_ref7 = ["afterUpdate", event];
event = _ref7[0];
prop = _ref7[1];
}

@@ -387,3 +355,3 @@

_context4.next = 4;
return (0, _get3.default)(DotStore.prototype.__proto__ || (0, _getPrototypeOf2.default)(DotStore.prototype), "once", this).call(this, event);
return (0, _get2.default)((0, _getPrototypeOf2.default)(DotStore.prototype), "once", this).call(this, event);

@@ -400,3 +368,3 @@ case 4:

return _context4.abrupt("return", (0, _extends3.default)({}, options, vars));
return _context4.abrupt("return", (0, _objectSpread2.default)({}, options, vars));

@@ -412,3 +380,3 @@ case 9:

_context4.next = 14;
return (0, _get3.default)(DotStore.prototype.__proto__ || (0, _getPrototypeOf2.default)(DotStore.prototype), "once", this).call(this, event);
return (0, _get2.default)((0, _getPrototypeOf2.default)(DotStore.prototype), "once", this).call(this, event);

@@ -426,7 +394,5 @@ case 14:

function once(_x8, _x9) {
return _ref9.apply(this, arguments);
}
return once;
return function once(_x6, _x7) {
return _once.apply(this, arguments);
};
}()

@@ -436,6 +402,8 @@ }, {

value: function () {
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee5(event, prop) {
var _ref12, value;
var _onceExists = (0, _asyncToGenerator2.default)(
/*#__PURE__*/
_regenerator.default.mark(function _callee5(event, prop) {
var _ref8, value;
return _regenerator2.default.wrap(function _callee5$(_context5) {
return _regenerator.default.wrap(function _callee5$(_context5) {
while (1) {

@@ -445,5 +413,6 @@ switch (_context5.prev = _context5.next) {

if (!prop && !event.match(opEventRegex)) {
;_ref12 = ["afterUpdate", event];
event = _ref12[0];
prop = _ref12[1];
;
_ref8 = ["afterUpdate", event];
event = _ref8[0];
prop = _ref8[1];
}

@@ -488,7 +457,5 @@

function onceExists(_x10, _x11) {
return _ref11.apply(this, arguments);
}
return onceExists;
return function onceExists(_x8, _x9) {
return _onceExists.apply(this, arguments);
};
}()

@@ -499,16 +466,18 @@ }, {

if (!listener) {
;var _ref13 = ["afterUpdate", event];
event = _ref13[0];
listener = _ref13[1];
;
var _ref9 = ["afterUpdate", event];
event = _ref9[0];
listener = _ref9[1];
} else if (!event.match(opEventRegex)) {
throw new TypeError("off event must be " + opEventRegex);
throw new TypeError("off event must be ".concat(opEventRegex));
}
(0, _get3.default)(DotStore.prototype.__proto__ || (0, _getPrototypeOf2.default)(DotStore.prototype), "off", this).call(this, event, listener);
(0, _get2.default)((0, _getPrototypeOf2.default)(DotStore.prototype), "off", this).call(this, event, listener);
}
}]);
(0, _inherits2.default)(DotStore, _Emitter);
return DotStore;
}(_emitter2.default);
}(_emitter.default);
exports.default = DotStore;
//# sourceMappingURL=index.js.map

@@ -8,2 +8,3 @@ "use strict";

exports.propToArray = propToArray;
function capitalize(str) {

@@ -10,0 +11,0 @@ return str.charAt(0).toUpperCase() + str.slice(1);

{
"name": "dot-store",
"version": "2.2.8",
"version": "2.3.0",
"description": "Like Redux, but easy",

@@ -32,12 +32,12 @@ "keywords": [

"dependencies": {
"babel-runtime": "^6.26.0",
"@babel/runtime": "^7.0.0-beta.47",
"dot-prop-immutable": "^1.4.0"
},
"devDependencies": {
"babel-cli": "6",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.3",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"@babel/cli": "^7.0.0-beta.47",
"@babel/core": "^7.0.0-beta.47",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.47",
"@babel/plugin-transform-runtime": "^7.0.0-beta.47",
"@babel/preset-env": "^7.0.0-beta.47",
"babel-core": "^7.0.0-bridge.0",
"emittery": "^0.3.0",

@@ -48,2 +48,11 @@ "fxtr": "1",

},
"babel": {
"presets": [
"@babel/preset-env"
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-runtime"
]
},
"jest": {

@@ -50,0 +59,0 @@ "roots": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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