@azrico/webobject 1.4.128 → 1.4.129

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,71 +1,43 @@
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
- var 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
- exports.ObjectArray = ObjectArray;
70
- var _default = ObjectArray;
71
- exports["default"] = _default;
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;
@@ -43,8 +43,8 @@ export declare class ObjectManager<ObjType extends SimpleObject> extends RawObje
43
43
  getSaveResultType(): saveResultType | null;
44
44
  setSaveResult(toObj: any, type: saveResultType): saveResultType | undefined;
45
45
  apply_changes(): boolean;
46
- getValue(key: PropOf<ObjType>, original?: boolean): import("./SimpleObject").PropType<ObjType, any> | null;
47
- get: (key: PropOf<ObjType>, original?: boolean) => import("./SimpleObject").PropType<ObjType, any> | null;
46
+ getValue(key: PropOf<ObjType>, original?: boolean): import("@azrico/types").PropType<ObjType, any> | null;
47
+ get: (key: PropOf<ObjType>, original?: boolean) => import("@azrico/types").PropType<ObjType, any> | null;
48
48
  /**
49
49
  * set value
50
50
  * @param key