Socket
Socket
Sign inDemoInstall

dataparcels

Package Overview
Dependencies
7
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 2.0.0-alpha.0

lib/plugins/translate.js

20

lib/change/ChangeRequest.js

@@ -130,6 +130,2 @@ "use strict";

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} // $FlowFixMe - this doesn't have side effects

@@ -145,6 +141,2 @@ }, {

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} // $FlowFixMe - this doesn't have side effects

@@ -155,6 +147,2 @@ }, {

return this._actions;
} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
}

@@ -167,6 +155,2 @@ }, {

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} // $FlowFixMe - this doesn't have side effects

@@ -177,6 +161,2 @@ }, {

return this._originPath;
} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
}

@@ -183,0 +163,0 @@ }]);

6

lib/change/ChangeRequestReducer.js

@@ -14,2 +14,4 @@ "use strict";

var _findLastIndex = _interopRequireDefault(require("unmutable/lib/findLastIndex"));
var _Errors = require("../errors/Errors");

@@ -140,5 +142,5 @@

var lastGetIndex = steps.lastIndexOf(function (step) {
var lastGetIndex = (0, _findLastIndex.default)(function (step) {
return step.type === 'get';
});
})(steps);
steps = steps.slice(0, lastGetIndex);

@@ -145,0 +147,0 @@ }

@@ -6,10 +6,4 @@ "use strict";

});
exports.AsNodeReturnNonParcelNodeError = exports.ChangeRequestNoPrevDataError = exports.ReducerInvalidStepError = exports.ReducerInvalidActionError = exports.ParcelTypeMethodMismatch = exports.ReadOnlyError = void 0;
exports.AsNodeReturnNonParcelNodeError = exports.ChangeRequestNoPrevDataError = exports.ReducerInvalidStepError = exports.ReducerInvalidActionError = exports.ParcelTypeMethodMismatch = void 0;
var ReadOnlyError = function ReadOnlyError() {
return new Error("This property is read-only");
};
exports.ReadOnlyError = ReadOnlyError;
var ParcelTypeMethodMismatch = function ParcelTypeMethodMismatch(key, parcelType, path) {

@@ -16,0 +10,0 @@ var suffix = Array.isArray(path) ? "(keyPath: [".concat(path.join(', '), "]).") : "";

@@ -74,2 +74,7 @@ "use strict";

var Parent = 'Parent';
var Child = 'Child';
var Indexed = 'Indexed';
var Element = 'Element';
var DEFAULT_CONFIG_INTERNAL = function DEFAULT_CONFIG_INTERNAL() {

@@ -81,2 +86,3 @@ return {

meta: {},
sharedMeta: {},
rawId: ["^"],

@@ -86,4 +92,4 @@ rawPath: ["^"],

isIndexed: false,
isChildFirst: false,
isChildLast: false
isFirstChild: false,
isLastChild: false
},

@@ -108,3 +114,2 @@ registry: {},

// Parent methods
// Child methods
// Side-effect methods

@@ -115,3 +120,2 @@ // Change methods

// Modify methods
// Type methods
// Composition methods

@@ -150,5 +154,2 @@ function Parcel() {

(0, _defineProperty2.default)(this, "has", void 0);
(0, _defineProperty2.default)(this, "size", void 0);
(0, _defineProperty2.default)(this, "isFirst", void 0);
(0, _defineProperty2.default)(this, "isLast", void 0);
(0, _defineProperty2.default)(this, "spy", void 0);

@@ -177,17 +178,2 @@ (0, _defineProperty2.default)(this, "spyChange", void 0);

(0, _defineProperty2.default)(this, "initialMeta", void 0);
(0, _defineProperty2.default)(this, "isChild", function () {
return _this._isChild;
});
(0, _defineProperty2.default)(this, "isElement", function () {
return _this._isElement;
});
(0, _defineProperty2.default)(this, "isIndexed", function () {
return _this._isIndexed;
});
(0, _defineProperty2.default)(this, "isParent", function () {
return _this._isParent;
});
(0, _defineProperty2.default)(this, "isTopLevel", function () {
return !_this._isChild;
});
(0, _defineProperty2.default)(this, "pipe", function () {

@@ -350,4 +336,4 @@ for (var _len = arguments.length, updaters = new Array(_len), _key = 0; _key < _len; _key++) {

var isIndexed = _this._isIndexed;
var isChildFirst = childIsNotEmpty && (0, _first.default)()(child).key === childKey;
var isChildLast = childIsNotEmpty && (0, _last.default)()(child).key === childKey;
var isFirstChild = childIsNotEmpty && (0, _first.default)()(child).key === childKey;
var isLastChild = childIsNotEmpty && (0, _last.default)()(child).key === childKey;
var rawId = [].concat((0, _toConsumableArray2.default)(_this._rawId), [isIndexed ? childKey : escapeKey(childKey)]);

@@ -363,4 +349,4 @@ var rawPath = [].concat((0, _toConsumableArray2.default)(_this._rawPath), [childKey]);

isIndexed: isIndexed,
isChildFirst: isChildFirst,
isChildLast: isChildLast
isFirstChild: isFirstChild,
isLastChild: isLastChild
}

@@ -458,8 +444,3 @@ });

})();
};
var Parent = 'Parent';
var Child = 'Child';
var Indexed = 'Indexed';
var Element = 'Element'; //
}; //
// public methods

@@ -469,2 +450,3 @@ //

this.spread = function (notFoundValue) {

@@ -517,8 +499,24 @@ return {

this.metaAsParcel = function (key) {
return new Parcel({
value: _this.meta[key],
handleChange: function handleChange(_ref3) {
var value = _ref3.value;
return _this.setMeta((0, _defineProperty2.default)({}, key, value));
}
return _this._create({
parcelData: {
value: _this.meta[key],
meta: _this.meta
},
handleChange: function handleChange(parcel, changeRequest) {
var newActions = changeRequest.actions.filter(function (action) {
return action.type === 'setMeta';
});
if (newActions.length !== changeRequest.actions.length) {
newActions.unshift(new _Action.default({
type: 'setMeta',
payload: (0, _defineProperty2.default)({}, key, parcel.value)
}));
}
_this.dispatch(changeRequest._create({
actions: newActions
}));
},
rawId: _this._idPushModifier("mp-".concat(key))
});

@@ -533,17 +531,5 @@ }; // Parent methods

return (0, _has.default)(key)(_this._parcelData);
});
this.size = onlyType(Parent, 'size', function () {
return (0, _size.default)()(_this.value);
}); // Child methods
this.isFirst = function () {
return _this._parent.isChildFirst;
};
this.isLast = function () {
return _this._parent.isChildLast;
}; // Side-effect methods
}); // Side-effect methods
// Types(`spy()`, `sideEffect`, `function`)(sideEffect);
this.spy = function (sideEffect) {

@@ -728,6 +714,2 @@ sideEffect(_this);

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} // $FlowFixMe - this doesn't have side effects

@@ -739,6 +721,2 @@ }, {

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} // $FlowFixMe - this doesn't have side effects

@@ -751,6 +729,2 @@ }, {

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} // $FlowFixMe - this doesn't have side effects

@@ -762,6 +736,2 @@ }, {

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} // $FlowFixMe - this doesn't have side effects

@@ -773,6 +743,2 @@ }, {

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} // $FlowFixMe - this doesn't have side effects

@@ -784,6 +750,46 @@ }, {

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
}, {
key: "size",
get: function get() {
return this._isParent ? (0, _size.default)()(this.value) : 0;
} // $FlowFixMe - this doesn't have side effects
}, {
key: "isFirstChild",
get: function get() {
return this._isChild ? this._parent.isFirstChild : false;
} // $FlowFixMe - this doesn't have side effects
}, {
key: "isLastChild",
get: function get() {
return this._isChild ? this._parent.isLastChild : false;
} // $FlowFixMe - this doesn't have side effects
}, {
key: "isOnlyChild",
get: function get() {
return this._isChild ? this._parent.isFirstChild && this._parent.isLastChild : false;
}
}, {
key: "isChild",
get: function get() {
return this._isChild;
}
}, {
key: "isElement",
get: function get() {
return this._isElement;
}
}, {
key: "isIndexed",
get: function get() {
return this._isIndexed;
}
}, {
key: "isParent",
get: function get() {
return this._isParent;
}
}]);

@@ -790,0 +796,0 @@ return Parcel;

@@ -18,4 +18,2 @@ "use strict";

var _Errors = require("../errors/Errors");
var _isParentValue = _interopRequireDefault(require("../parcelData/isParentValue"));

@@ -168,6 +166,2 @@

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} // $FlowFixMe - this doesn't have side effects

@@ -179,6 +173,2 @@ }, {

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} // $FlowFixMe - this doesn't have side effects

@@ -190,6 +180,2 @@ }, {

} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} // $FlowFixMe - this doesn't have side effects

@@ -200,6 +186,2 @@ }, {

return this.data.key;
} // $FlowFixMe - this doesn't have side effects
,
set: function set(value) {
throw (0, _Errors.ReadOnlyError)();
} //

@@ -206,0 +188,0 @@ // methods

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

// _control is meta that useParcelBuffer uses to trigger a submit or reset
// set this to null if a submit should not occur
// set this to null if its trying to submit, and the submut should not occur
_control: meta._control === 'submit' && !valid ? null : meta._control

@@ -74,0 +74,0 @@ };

{
"name": "dataparcels",
"version": "1.0.2",
"version": "2.0.0-alpha.0",
"description": "A library for editing data structures that works really well with React.",

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

"ParcelNode.js",
"translate.js",
"validation.js"

@@ -42,3 +43,3 @@ ],

"@babel/runtime": "^7.1.5",
"unmutable": "^0.46.1"
"unmutable": "^0.47.1"
},

@@ -55,3 +56,3 @@ "devDependencies": {

},
"gitHead": "0b3d7a74eb55920f65f4f63a59987595d63975e7"
"gitHead": "edb09b80f4f8f46cc49bc359098aa035ec7c9a2b"
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc