@ironcode/vas-lib 3.0.0-alpha.1 → 3.0.0-alpha.3

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.
Files changed (98) hide show
  1. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts +4 -2
  2. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts.map +1 -1
  3. package/cjs/lib/control-value/vas-camera-control-value.model.js.map +1 -1
  4. package/cjs/lib/entity/vas-field.dto.d.ts +3 -4
  5. package/cjs/lib/entity/vas-field.dto.d.ts.map +1 -1
  6. package/cjs/lib/entity/vas-field.dto.js.map +1 -1
  7. package/cjs/lib/entity/vas-job.model.js +1 -1
  8. package/cjs/lib/entity/vas-job.model.js.map +1 -1
  9. package/cjs/lib/model/estimate-control/estimate-control-value.dto.d.ts +14 -0
  10. package/cjs/lib/model/estimate-control/estimate-control-value.dto.d.ts.map +1 -0
  11. package/cjs/lib/model/estimate-control/estimate-control-value.dto.js +3 -0
  12. package/cjs/lib/model/estimate-control/estimate-control-value.dto.js.map +1 -0
  13. package/cjs/lib/model/estimate-control/estimate-control-value.model.d.ts +11 -0
  14. package/cjs/lib/model/estimate-control/estimate-control-value.model.d.ts.map +1 -0
  15. package/cjs/lib/model/estimate-control/estimate-control-value.model.js +84 -0
  16. package/cjs/lib/model/estimate-control/estimate-control-value.model.js.map +1 -0
  17. package/cjs/lib/model/estimate-control/estimate-item.dto.d.ts +16 -0
  18. package/cjs/lib/model/estimate-control/estimate-item.dto.d.ts.map +1 -0
  19. package/cjs/lib/model/estimate-control/estimate-item.dto.js +3 -0
  20. package/cjs/lib/model/estimate-control/estimate-item.dto.js.map +1 -0
  21. package/cjs/lib/model/estimate-control/estimate-item.model.d.ts +24 -0
  22. package/cjs/lib/model/estimate-control/estimate-item.model.d.ts.map +1 -0
  23. package/cjs/lib/model/estimate-control/estimate-item.model.js +121 -0
  24. package/cjs/lib/model/estimate-control/estimate-item.model.js.map +1 -0
  25. package/cjs/lib/model/estimate-control/estimate.dto.d.ts +37 -0
  26. package/cjs/lib/model/estimate-control/estimate.dto.d.ts.map +1 -0
  27. package/cjs/lib/model/estimate-control/estimate.dto.js +3 -0
  28. package/cjs/lib/model/estimate-control/estimate.dto.js.map +1 -0
  29. package/cjs/lib/model/estimate-control/estimate.model.d.ts +55 -0
  30. package/cjs/lib/model/estimate-control/estimate.model.d.ts.map +1 -0
  31. package/cjs/lib/model/estimate-control/estimate.model.js +265 -0
  32. package/cjs/lib/model/estimate-control/estimate.model.js.map +1 -0
  33. package/cjs/lib/model/estimate-control/estimate.types.d.ts +3 -0
  34. package/cjs/lib/model/estimate-control/estimate.types.d.ts.map +1 -0
  35. package/cjs/lib/model/estimate-control/estimate.types.js +3 -0
  36. package/cjs/lib/model/estimate-control/estimate.types.js.map +1 -0
  37. package/cjs/lib/model/estimate-control/index.d.ts +8 -0
  38. package/cjs/lib/model/estimate-control/index.d.ts.map +1 -0
  39. package/cjs/lib/model/estimate-control/index.js +11 -0
  40. package/cjs/lib/model/estimate-control/index.js.map +1 -0
  41. package/cjs/lib/model/index.d.ts +2 -0
  42. package/cjs/lib/model/index.d.ts.map +1 -1
  43. package/cjs/lib/model/index.js +2 -0
  44. package/cjs/lib/model/index.js.map +1 -1
  45. package/cjs/lib/model/report-invocation.d.ts +40 -0
  46. package/cjs/lib/model/report-invocation.d.ts.map +1 -0
  47. package/cjs/lib/model/report-invocation.js +3 -0
  48. package/cjs/lib/model/report-invocation.js.map +1 -0
  49. package/cjs/lib/utils/get-value-by-path.d.ts +5 -15
  50. package/cjs/lib/utils/get-value-by-path.d.ts.map +1 -1
  51. package/cjs/lib/utils/get-value-by-path.js +49 -60
  52. package/cjs/lib/utils/get-value-by-path.js.map +1 -1
  53. package/cjs/lib/utils/index.d.ts +8 -0
  54. package/cjs/lib/utils/index.d.ts.map +1 -0
  55. package/cjs/lib/utils/index.js +11 -0
  56. package/cjs/lib/utils/index.js.map +1 -0
  57. package/cjs/lib/utils/is-array-string.d.ts +3 -0
  58. package/cjs/lib/utils/is-array-string.d.ts.map +1 -1
  59. package/cjs/lib/utils/is-array-string.js +3 -0
  60. package/cjs/lib/utils/is-array-string.js.map +1 -1
  61. package/cjs/lib/utils/is-numeric.d.ts +2 -0
  62. package/cjs/lib/utils/is-numeric.d.ts.map +1 -0
  63. package/cjs/lib/utils/is-numeric.js +10 -0
  64. package/cjs/lib/utils/is-numeric.js.map +1 -0
  65. package/cjs/lib/utils/is-plain-object.d.ts +3 -0
  66. package/cjs/lib/utils/is-plain-object.d.ts.map +1 -1
  67. package/cjs/lib/utils/is-plain-object.js +3 -0
  68. package/cjs/lib/utils/is-plain-object.js.map +1 -1
  69. package/cjs/lib/utils/try-json.d.ts +2 -2
  70. package/cjs/lib/utils/try-json.js +2 -2
  71. package/cjs/lib/utils/try-json.js.map +1 -1
  72. package/cjs/public-api.d.ts +1 -0
  73. package/cjs/public-api.d.ts.map +1 -1
  74. package/cjs/public-api.js +1 -0
  75. package/cjs/public-api.js.map +1 -1
  76. package/fesm2022/ironcode-vas-lib.mjs +548 -56
  77. package/fesm2022/ironcode-vas-lib.mjs.map +1 -1
  78. package/lib/control-value/vas-camera-control-value.model.d.ts +4 -2
  79. package/lib/entity/vas-field.dto.d.ts +3 -4
  80. package/lib/model/estimate-control/estimate-control-value.dto.d.ts +13 -0
  81. package/lib/model/estimate-control/estimate-control-value.model.d.ts +10 -0
  82. package/lib/model/estimate-control/estimate-item.dto.d.ts +15 -0
  83. package/lib/model/estimate-control/estimate-item.model.d.ts +23 -0
  84. package/lib/model/estimate-control/estimate.dto.d.ts +36 -0
  85. package/lib/model/estimate-control/estimate.model.d.ts +54 -0
  86. package/lib/model/estimate-control/estimate.types.d.ts +2 -0
  87. package/lib/model/estimate-control/index.d.ts +7 -0
  88. package/lib/model/index.d.ts +2 -0
  89. package/lib/model/report-invocation.d.ts +39 -0
  90. package/lib/utils/get-value-by-path.d.ts +5 -15
  91. package/lib/utils/index.d.ts +7 -0
  92. package/lib/utils/is-array-string.d.ts +4 -0
  93. package/lib/utils/is-numeric.d.ts +1 -0
  94. package/lib/utils/is-plain-object.d.ts +3 -0
  95. package/lib/utils/omit.d.ts +7 -0
  96. package/lib/utils/try-json.d.ts +2 -2
  97. package/package.json +3 -2
  98. package/public-api.d.ts +1 -0
@@ -1,68 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getValueByPath = void 0;
4
- /**
5
- * A non sophisticated way to get values from the job via paths. For example:
6
- *
7
- * getValueByPath(
8
- * ['foo', 'bar'],
9
- * {
10
- * foo: {
11
- * bar: 'value'
12
- * }
13
- * }
14
- * );
15
- *
16
- * will return "value"
17
- * @param {string[]} path
18
- * @param {Record<string, FieldValueType>} object
19
- * @return {T | undefined}
20
- */
21
- const getValueByPath = (path, object) => {
22
- switch (path.length) {
23
- case 0: {
3
+ exports.getValueByPath = getValueByPath;
4
+ const is_numeric_1 = require("./is-numeric");
5
+ function coalescePath(pathOrPaths) {
6
+ let keys = [];
7
+ if (typeof pathOrPaths === 'string') {
8
+ keys = pathOrPaths.split('.');
9
+ }
10
+ else if (typeof pathOrPaths === 'number') {
11
+ keys = [pathOrPaths];
12
+ }
13
+ else if (Array.isArray(pathOrPaths)) {
14
+ keys = pathOrPaths;
15
+ }
16
+ else {
17
+ throw Error('Expected string, number or array of strings or numbers');
18
+ }
19
+ const result = [];
20
+ keys.forEach(key => {
21
+ if (typeof key === 'number') {
22
+ result.push(key);
24
23
  return;
25
24
  }
26
- case 1: {
27
- return (object)[path[0]];
28
- }
29
- case 2: {
30
- const val0 = object[path[0]];
31
- if (!val0) {
32
- return undefined;
25
+ if (key.endsWith(']')) {
26
+ const match = /^([\w_#$-]+)\[([\w_#$-]+)]$/.exec(key.toString());
27
+ if (match !== null) {
28
+ result.push(match[1]);
29
+ result.push((0, is_numeric_1.isNumeric)(match[2]) ? parseInt(match[2], 10) : match[2]);
30
+ return;
33
31
  }
34
- return val0[path[1]];
35
- }
36
- case 3: {
37
- const val0 = object[path[0]];
38
- if (!val0) {
39
- return undefined;
40
- }
41
- const val1 = val0[path[1]];
42
- if (!val1) {
43
- return undefined;
44
- }
45
- return val1[path[2]];
46
- }
47
- case 4: {
48
- const val0 = object[path[0]];
49
- if (!val0) {
50
- return undefined;
51
- }
52
- const val1 = val0[path[1]];
53
- if (!val1) {
54
- return undefined;
55
- }
56
- const val2 = val1[path[2]];
57
- if (!val2) {
58
- return undefined;
59
- }
60
- return val2[path[3]];
61
- }
62
- default: {
63
- throw Error('path has too many segments');
64
32
  }
33
+ result.push(key);
34
+ });
35
+ return result;
36
+ }
37
+ /**
38
+ * Get a value from an object by path.
39
+ *
40
+ * Path can be an array of strings or numbers.
41
+ * Path can be a string using dot notation, which can include square brackets to
42
+ * access array positions e.g. foo.bar[0].baz
43
+ */
44
+ function getValueByPath(path, object) {
45
+ const p = coalescePath(path);
46
+ let scope = object === undefined ? null : object;
47
+ let index = 0;
48
+ const length = p.length;
49
+ while (!(scope === undefined || scope === null) && index < length) {
50
+ scope = scope[p[index++]];
65
51
  }
66
- };
67
- exports.getValueByPath = getValueByPath;
52
+ if (!(index && index == length) || scope === null) {
53
+ return undefined;
54
+ }
55
+ return scope;
56
+ }
68
57
  //# sourceMappingURL=get-value-by-path.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-value-by-path.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/get-value-by-path.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,cAAc,GAAG,CAC5B,IAAc,EACd,MAA2B,EACZ,EAAE;IACjB,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,CAAC,CAAC,CAAC;YACP,OAAO;QACT,CAAC;QACD,KAAK,CAAC,CAAC,CAAC,CAAC;YACP,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAM,CAAC;QAChC,CAAC;QACD,KAAK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AA4B,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAhDW,QAAA,cAAc,kBAgDzB","sourcesContent":["/**\n * A non sophisticated way to get values from the job via paths. For example:\n *\n * getValueByPath(\n * ['foo', 'bar'],\n * {\n * foo: {\n * bar: 'value'\n * }\n * }\n * );\n *\n * will return \"value\"\n * @param {string[]} path\n * @param {Record<string, FieldValueType>} object\n * @return {T | undefined}\n */\nexport const getValueByPath = <T>(\n path: string[],\n object: Record<string, any>\n): T | undefined => {\n switch (path.length) {\n case 0: {\n return;\n }\n case 1: {\n return (object)[path[0]] as T;\n }\n case 2: {\n const val0 = object[path[0]] as Record<string, object>;\n if (!val0) {\n return undefined;\n }\n return val0[path[1]] as T;\n }\n case 3: {\n const val0 = object[path[0]] as Record<string, object>;\n if (!val0) {\n return undefined;\n }\n const val1 = val0[path[1]] as Record<string, object>;\n if (!val1) {\n return undefined;\n }\n return val1[path[2]] as T;\n }\n case 4: {\n const val0 = object[path[0]] as Record<string, object>;\n if (!val0) {\n return undefined;\n }\n const val1 = val0[path[1]] as Record<string, object>;\n if (!val1) {\n return undefined;\n }\n const val2 = val1[path[2]] as Record<string, object>;\n if (!val2) {\n return undefined;\n }\n return val2[path[3]] as T;\n }\n default: {\n throw Error('path has too many segments');\n }\n }\n};\n"]}
1
+ {"version":3,"file":"get-value-by-path.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/get-value-by-path.ts"],"names":[],"mappings":";;AA0CA,wCAgBC;AA1DD,6CAAyC;AAEzC,SAAS,YAAY,CACnB,WAAqD;IAErD,IAAI,IAAI,GAA2B,EAAE,CAAC;IACtC,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpC,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;SAAM,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QAC3C,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC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AAG,CAAC,CAAC;IACd,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAExB,OAAO,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,MAAM,EAAE,CAAC;QAClE,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,CAAC,CAAC,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAClD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,KAAU,CAAC;AACpB,CAAC","sourcesContent":["import { isNumeric } from './is-numeric';\n\nfunction coalescePath(\n pathOrPaths: string | number | Array<string | number>\n): Array<string | number> {\n let keys: Array<string | number> = [];\n if (typeof pathOrPaths === 'string') {\n keys = pathOrPaths.split('.');\n } else if (typeof pathOrPaths === 'number') {\n keys = [pathOrPaths];\n } else if (Array.isArray(pathOrPaths)) {\n keys = pathOrPaths;\n } else {\n throw Error('Expected string, number or array of strings or numbers');\n }\n const result: Array<string | number> = [];\n keys.forEach(key => {\n if (typeof key === 'number') {\n result.push(key);\n return;\n }\n if (key.endsWith(']')) {\n const match = /^([\\w_#$-]+)\\[([\\w_#$-]+)]$/.exec(key.toString());\n if (match !== null) {\n result.push(match[1]);\n result.push(isNumeric(match[2]) ? parseInt(match[2], 10) : match[2]);\n return;\n }\n }\n result.push(key);\n });\n return result;\n}\n\n\n/**\n * Get a value from an object by path.\n *\n * Path can be an array of strings or numbers.\n * Path can be a string using dot notation, which can include square brackets to\n * access array positions e.g. foo.bar[0].baz\n */\nexport function getValueByPath<T>(\n path: string | number | Array<string | number>,\n object: null | Record<string, any>\n): T | undefined {\n const p = coalescePath(path);\n let scope = object === undefined ? null : object;\n let index = 0;\n const length = p.length;\n\n while (!(scope === undefined || scope === null) && index < length) {\n scope = scope[p[index++]];\n }\n if (!(index && index == length) || scope === null) {\n return undefined;\n }\n return scope as T;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ export * from './get-value-by-path';
2
+ export * from './is-array-string';
3
+ export * from './is-numeric';
4
+ export * from './is-plain-object';
5
+ export * from './omit';
6
+ export * from './only';
7
+ export * from './try-json';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./get-value-by-path"), exports);
5
+ tslib_1.__exportStar(require("./is-array-string"), exports);
6
+ tslib_1.__exportStar(require("./is-numeric"), exports);
7
+ tslib_1.__exportStar(require("./is-plain-object"), exports);
8
+ tslib_1.__exportStar(require("./omit"), exports);
9
+ tslib_1.__exportStar(require("./only"), exports);
10
+ tslib_1.__exportStar(require("./try-json"), exports);
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,4DAAkC;AAClC,uDAA6B;AAC7B,4DAAiC;AACjC,iDAAsB;AACtB,iDAAsB;AACtB,qDAA0B","sourcesContent":["export * from './get-value-by-path';\nexport * from './is-array-string';\nexport * from './is-numeric';\nexport * from './is-plain-object'\nexport * from './omit'\nexport * from './only'\nexport * from './try-json'\n"]}
@@ -1,2 +1,5 @@
1
+ /**
2
+ * Return true IFF the array contains only strings
3
+ */
1
4
  export declare const isArrayString: (value: any) => value is Array<string>;
2
5
  //# sourceMappingURL=is-array-string.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-array-string.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/is-array-string.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,UAAW,GAAG,KAAG,KAAK,IAAI,KAAK,CAAC,MAAM,CAE/D,CAAC"}
1
+ {"version":3,"file":"is-array-string.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/is-array-string.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa,UAAW,GAAG,KAAG,KAAK,IAAI,KAAK,CAAC,MAAM,CAE/D,CAAC"}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isArrayString = void 0;
4
+ /**
5
+ * Return true IFF the array contains only strings
6
+ */
4
7
  const isArrayString = (value) => {
5
8
  return Array.isArray(value) && value.every(i => typeof i === 'string');
6
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"is-array-string.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/is-array-string.ts"],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,CAAC,KAAU,EAA0B,EAAE;IAClE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AACzE,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB","sourcesContent":["export const isArrayString = (value: any): value is Array<string> => {\n return Array.isArray(value) && value.every(i => typeof i === 'string');\n};\n"]}
1
+ {"version":3,"file":"is-array-string.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/is-array-string.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,aAAa,GAAG,CAAC,KAAU,EAA0B,EAAE;IAClE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AACzE,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB","sourcesContent":["/**\n * Return true IFF the array contains only strings\n */\nexport const isArrayString = (value: any): value is Array<string> => {\n return Array.isArray(value) && value.every(i => typeof i === 'string');\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isNumeric(value: string | number): value is number;
2
+ //# sourceMappingURL=is-numeric.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-numeric.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/is-numeric.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,IAAI,MAAM,CAKjE"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNumeric = isNumeric;
4
+ function isNumeric(value) {
5
+ if (typeof value === 'number') {
6
+ return !isNaN(value);
7
+ }
8
+ return /^-?\d+$/.test(value.trim());
9
+ }
10
+ //# sourceMappingURL=is-numeric.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-numeric.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/is-numeric.ts"],"names":[],"mappings":";;AAAA,8BAKC;AALD,SAAgB,SAAS,CAAC,KAAsB;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AACtC,CAAC","sourcesContent":["export function isNumeric(value: string | number): value is number {\n if (typeof value === 'number') {\n return !isNaN(value);\n }\n return /^-?\\d+$/.test(value.trim());\n}\n"]}
@@ -1,2 +1,5 @@
1
+ /**
2
+ * Return true if the argument is a plain object {}, i.e. not an array, null.
3
+ */
1
4
  export declare function isPlainObject<T>(value: any): value is T;
2
5
  //# sourceMappingURL=is-plain-object.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-plain-object.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/is-plain-object.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,CAAC,CAEvD"}
1
+ {"version":3,"file":"is-plain-object.d.ts","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/is-plain-object.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,CAAC,CAEvD"}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isPlainObject = isPlainObject;
4
+ /**
5
+ * Return true if the argument is a plain object {}, i.e. not an array, null.
6
+ */
4
7
  function isPlainObject(value) {
5
8
  return typeof value === 'object' && value !== null && !Array.isArray(value);
6
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-plain-object.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/is-plain-object.ts"],"names":[],"mappings":";;AAAA,sCAEC;AAFD,SAAgB,aAAa,CAAI,KAAU;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["export function isPlainObject<T>(value: any): value is T {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"]}
1
+ {"version":3,"file":"is-plain-object.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/is-plain-object.ts"],"names":[],"mappings":";;AAGA,sCAEC;AALD;;GAEG;AACH,SAAgB,aAAa,CAAI,KAAU;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["/**\n * Return true if the argument is a plain object {}, i.e. not an array, null.\n */\nexport function isPlainObject<T>(value: any): value is T {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Try to parse the value as JSON if it looks like a JSON encoded string
3
- * @param value
2
+ * Try to parse the value as JSON if it looks like a JSON encoded string, return
3
+ * the original value if it's not a JSON string or parsing fails.
4
4
  */
5
5
  export declare const tryJson: <T>(value: T) => Record<string, any> | T;
6
6
  //# sourceMappingURL=try-json.d.ts.map
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tryJson = void 0;
4
4
  /**
5
- * Try to parse the value as JSON if it looks like a JSON encoded string
6
- * @param value
5
+ * Try to parse the value as JSON if it looks like a JSON encoded string, return
6
+ * the original value if it's not a JSON string or parsing fails.
7
7
  */
8
8
  const tryJson = (value) => {
9
9
  if (typeof value === 'string' && ['{', '['].includes(value.substring(0, 1))) {
@@ -1 +1 @@
1
- {"version":3,"file":"try-json.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/try-json.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACI,MAAM,OAAO,GAAG,CAAI,KAAQ,EAA2B,EAAE;IAC9D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AATW,QAAA,OAAO,WASlB","sourcesContent":["/**\n * Try to parse the value as JSON if it looks like a JSON encoded string\n * @param value\n */\nexport const tryJson = <T>(value: T): Record<string, any> | T => {\n if (typeof value === 'string' && ['{', '['].includes(value.substring(0, 1))) {\n try {\n return JSON.parse(value);\n } catch (e) {\n return value;\n }\n }\n return value;\n};\n"]}
1
+ {"version":3,"file":"try-json.js","sourceRoot":"","sources":["../../../../../projects/vas-lib/src/lib/utils/try-json.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACI,MAAM,OAAO,GAAG,CAAI,KAAQ,EAA2B,EAAE;IAC9D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AATW,QAAA,OAAO,WASlB","sourcesContent":["/**\n * Try to parse the value as JSON if it looks like a JSON encoded string, return\n * the original value if it's not a JSON string or parsing fails.\n */\nexport const tryJson = <T>(value: T): Record<string, any> | T => {\n if (typeof value === 'string' && ['{', '['].includes(value.substring(0, 1))) {\n try {\n return JSON.parse(value);\n } catch (e) {\n return value;\n }\n }\n return value;\n};\n"]}
@@ -3,4 +3,5 @@ export * from './lib/controls-config/index';
3
3
  export * from './lib/elastic/index';
4
4
  export * from './lib/entity/index';
5
5
  export * from './lib/model/index';
6
+ export * from './lib/utils';
6
7
  //# sourceMappingURL=public-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../../../projects/vas-lib/src/public-api.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../../../projects/vas-lib/src/public-api.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
package/cjs/public-api.js CHANGED
@@ -6,4 +6,5 @@ tslib_1.__exportStar(require("./lib/controls-config/index"), exports);
6
6
  tslib_1.__exportStar(require("./lib/elastic/index"), exports);
7
7
  tslib_1.__exportStar(require("./lib/entity/index"), exports);
8
8
  tslib_1.__exportStar(require("./lib/model/index"), exports);
9
+ tslib_1.__exportStar(require("./lib/utils"), exports);
9
10
  //# sourceMappingURL=public-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../../projects/vas-lib/src/public-api.ts"],"names":[],"mappings":";;;AAAA,oEAA0C;AAC1C,sEAA4C;AAC5C,8DAAoC;AACpC,6DAAmC;AACnC,4DAAkC","sourcesContent":["export * from './lib/control-value/index';\nexport * from './lib/controls-config/index';\nexport * from './lib/elastic/index';\nexport * from './lib/entity/index';\nexport * from './lib/model/index';\n"]}
1
+ {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../../../projects/vas-lib/src/public-api.ts"],"names":[],"mappings":";;;AAAA,oEAA0C;AAC1C,sEAA4C;AAC5C,8DAAoC;AACpC,6DAAmC;AACnC,4DAAkC;AAClC,sDAA4B","sourcesContent":["export * from './lib/control-value/index';\nexport * from './lib/controls-config/index';\nexport * from './lib/elastic/index';\nexport * from './lib/entity/index';\nexport * from './lib/model/index';\nexport * from './lib/utils';\n"]}