dataflux 1.5.3 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/BasicObj.js CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.dateRegex = exports.BasicObj = void 0;
7
+ exports.setValues = setValues;
7
8
 
8
9
  var _moment = _interopRequireDefault(require("moment/moment"));
9
10
 
@@ -33,9 +34,30 @@ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!priva
33
34
 
34
35
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
35
36
 
37
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
38
+
36
39
  var dateRegex = new RegExp("^[0-9][0-9][0-9][0-9]-[0-9].*T[0-9].*Z$");
37
40
  exports.dateRegex = dateRegex;
38
41
 
42
+ function setValues(values, model, SubObj, parent, context) {
43
+ Object.keys(values).forEach(function (key) {
44
+ var value = values[key];
45
+
46
+ if (model.options.parseMoment && value != null && dateRegex.test(value)) {
47
+ var mmnt = (0, _moment["default"])(value);
48
+ context[key] = mmnt.isValid() ? mmnt : value;
49
+ } else if (model.options.deep && value != null && _typeof(value) === "object" && !Array.isArray(value)) {
50
+ context[key] = new SubObj(parent, key, value, model);
51
+ } else if (model.options.deep && value != null && Array.isArray(value)) {
52
+ context[key] = value.map(function (i) {
53
+ return new SubObj(parent, key, i, model);
54
+ });
55
+ } else {
56
+ context[key] = value;
57
+ }
58
+ });
59
+ }
60
+
39
61
  var _setHidden = /*#__PURE__*/new WeakMap();
40
62
 
41
63
  var _id = /*#__PURE__*/new WeakMap();
package/dist/Obj.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -7,18 +9,12 @@ exports["default"] = void 0;
7
9
 
8
10
  var _fingerprint = _interopRequireDefault(require("./fingerprint"));
9
11
 
10
- var _uuid = require("uuid");
11
-
12
12
  var _BasicObj2 = require("./BasicObj");
13
13
 
14
- var _moment = _interopRequireDefault(require("moment/moment"));
15
-
16
14
  var _SubObj = _interopRequireDefault(require("./SubObj"));
17
15
 
18
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
17
 
20
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
21
-
22
18
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
19
 
24
20
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -110,22 +106,7 @@ var Obj = /*#__PURE__*/function (_BasicObj) {
110
106
  return _this.getModel().getStore().update([_assertThisInitialized(_this)]);
111
107
  });
112
108
 
113
- Object.keys(values).forEach(function (key) {
114
- var value = values[key];
115
-
116
- if (_model.options.parseMoment && _BasicObj2.dateRegex.test(value)) {
117
- var mmnt = (0, _moment["default"])(value);
118
- _this[key] = mmnt.isValid() ? mmnt : value;
119
- } else if (_model.options.deep && _typeof(value) === "object" && !Array.isArray(value)) {
120
- _this[key] = new _SubObj["default"](_assertThisInitialized(_this), key, value, _model);
121
- } else if (_model.options.deep && Array.isArray(value)) {
122
- _this[key] = value.map(function (i) {
123
- return new _SubObj["default"](_assertThisInitialized(_this), key, i, _model);
124
- });
125
- } else {
126
- _this[key] = value;
127
- }
128
- });
109
+ (0, _BasicObj2.setValues)(values, _model, _SubObj["default"], _assertThisInitialized(_this), _assertThisInitialized(_this));
129
110
 
130
111
  _this.getModel = function () {
131
112
  return _model;
package/dist/SubObj.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -11,8 +13,6 @@ var _moment = _interopRequireDefault(require("moment/moment"));
11
13
 
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
15
 
14
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
15
-
16
16
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
17
17
 
18
18
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -110,22 +110,7 @@ var SubObj = /*#__PURE__*/function (_BasicObj) {
110
110
 
111
111
  _classPrivateFieldSet(_assertThisInitialized(_this), _parentField, field);
112
112
 
113
- Object.keys(values).forEach(function (key) {
114
- var value = values[key];
115
-
116
- if (model.options.parseMoment && _BasicObj2.dateRegex.test(value)) {
117
- var mmnt = (0, _moment["default"])(value);
118
- _this[key] = mmnt.isValid() ? mmnt : value;
119
- } else if (model.options.deep && _typeof(value) === "object" && !Array.isArray(value)) {
120
- _this[key] = new SubObj(_classPrivateFieldGet(_assertThisInitialized(_this), _parent), key, value, model);
121
- } else if (model.options.deep && Array.isArray(value)) {
122
- _this[key] = value.map(function (i) {
123
- return new SubObj(_classPrivateFieldGet(_assertThisInitialized(_this), _parent), key, i, model);
124
- });
125
- } else {
126
- _this[key] = value;
127
- }
128
- });
113
+ (0, _BasicObj2.setValues)(values, model, SubObj, _classPrivateFieldGet(_assertThisInitialized(_this), _parent), _assertThisInitialized(_this));
129
114
  return _this;
130
115
  }
131
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dataflux",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "DataFlux, automatically interfaces with your REST APIs to create a 2-way-synced local data store. Transparently manages data propagation in the React state.",
5
5
  "main": "dist/index.js",
6
6
  "bin": "dist/index.js",