@azrico/webobject 1.4.129 → 1.4.131

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.
@@ -1,43 +1,69 @@
1
- export class ObjectArray {
2
- /* -------------------------------------------------------------------------- */
3
- /* Values */
4
- /* -------------------------------------------------------------------------- */
5
- objArray = [];
6
- /* -------------------------------------------------------------------------- */
7
- /* Base */
8
- /* -------------------------------------------------------------------------- */
9
- constructor(initObject, mapto_type) {
10
- this.setObjects(initObject, mapto_type);
11
- }
12
- addObjects(initObject, mapto_type) {
13
- if (initObject == null)
14
- return false;
15
- let resultObjects = ObjectArray.flattenWebObjects(initObject);
16
- if (mapto_type)
17
- resultObjects = resultObjects.map((r) => r instanceof mapto_type ? r : new mapto_type(r));
18
- resultObjects.map((s) => this.objArray.push(s));
19
- return true;
20
- }
21
- setObjects(initObject, mapto_type) {
22
- this.objArray = [];
23
- this.addObjects(initObject, mapto_type);
24
- }
25
- getObjects() {
26
- return this.objArray;
27
- }
28
- static flattenWebObjects(inputData) {
29
- if (inputData instanceof ObjectArray) {
30
- return ObjectArray.flattenWebObjects(inputData.objArray);
31
- }
32
- else if (Array.isArray(inputData)) {
33
- let final_result = [];
34
- inputData.map((ind) => {
35
- ObjectArray.flattenWebObjects(ind).map((s) => final_result.push(s));
36
- });
37
- return final_result;
38
- }
39
- else
40
- return [inputData];
41
- }
42
- }
43
- export default ObjectArray;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.ObjectArray = void 0;
7
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
+ 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, _toPropertyKey(descriptor.key), descriptor); } }
10
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
+ var ObjectArray = exports.ObjectArray = /*#__PURE__*/function () {
15
+ /* -------------------------------------------------------------------------- */
16
+ /* Base */
17
+ /* -------------------------------------------------------------------------- */
18
+ function ObjectArray(initObject, mapto_type) {
19
+ _classCallCheck(this, ObjectArray);
20
+ /* -------------------------------------------------------------------------- */
21
+ /* Values */
22
+ /* -------------------------------------------------------------------------- */
23
+ _defineProperty(this, "objArray", []);
24
+ this.setObjects(initObject, mapto_type);
25
+ }
26
+ _createClass(ObjectArray, [{
27
+ key: "addObjects",
28
+ value: function addObjects(initObject, mapto_type) {
29
+ var _this = this;
30
+ if (initObject == null) return false;
31
+ var resultObjects = ObjectArray.flattenWebObjects(initObject);
32
+ if (mapto_type) resultObjects = resultObjects.map(function (r) {
33
+ return r instanceof mapto_type ? r : new mapto_type(r);
34
+ });
35
+ resultObjects.map(function (s) {
36
+ return _this.objArray.push(s);
37
+ });
38
+ return true;
39
+ }
40
+ }, {
41
+ key: "setObjects",
42
+ value: function setObjects(initObject, mapto_type) {
43
+ this.objArray = [];
44
+ this.addObjects(initObject, mapto_type);
45
+ }
46
+ }, {
47
+ key: "getObjects",
48
+ value: function getObjects() {
49
+ return this.objArray;
50
+ }
51
+ }], [{
52
+ key: "flattenWebObjects",
53
+ value: function flattenWebObjects(inputData) {
54
+ if (inputData instanceof ObjectArray) {
55
+ return ObjectArray.flattenWebObjects(inputData.objArray);
56
+ } else if (Array.isArray(inputData)) {
57
+ var final_result = [];
58
+ inputData.map(function (ind) {
59
+ ObjectArray.flattenWebObjects(ind).map(function (s) {
60
+ return final_result.push(s);
61
+ });
62
+ });
63
+ return final_result;
64
+ } else return [inputData];
65
+ }
66
+ }]);
67
+ return ObjectArray;
68
+ }();
69
+ var _default = exports["default"] = ObjectArray;
@@ -1,4 +1,4 @@
1
- import { PropOf, WriteablePropOf } from "./SimpleObject";
1
+ import { PropOf, WriteablePropOf } from "@azrico/types";
2
2
  import SimpleObject from "./SimpleObject";
3
3
  import { saveResultType, sendChangesType } from "./SimpleObject";
4
4
  import { ClassType } from "@azrico/types";