@schukai/monster 1.14.1 → 1.15.0

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 (139) hide show
  1. package/CHANGELOG +14 -0
  2. package/README.md +5 -5
  3. package/dist/modules/constants.js +2 -2
  4. package/dist/modules/constraints/abstract.js +2 -2
  5. package/dist/modules/constraints/abstractoperator.js +2 -2
  6. package/dist/modules/constraints/andoperator.js +2 -2
  7. package/dist/modules/constraints/invalid.js +2 -2
  8. package/dist/modules/constraints/isarray.js +2 -2
  9. package/dist/modules/constraints/isobject.js +2 -2
  10. package/dist/modules/constraints/namespace.js +1 -1
  11. package/dist/modules/constraints/oroperator.js +2 -2
  12. package/dist/modules/constraints/valid.js +2 -2
  13. package/dist/modules/data/buildmap.js +2 -2
  14. package/dist/modules/data/diff.js +2 -2
  15. package/dist/modules/data/extend.js +2 -2
  16. package/dist/modules/data/namespace.js +1 -1
  17. package/dist/modules/data/pathfinder.js +2 -2
  18. package/dist/modules/data/pipe.js +2 -2
  19. package/dist/modules/data/transformer.js +2 -2
  20. package/dist/modules/dom/assembler.js +2 -2
  21. package/dist/modules/dom/attributes.js +2 -2
  22. package/dist/modules/dom/constants.js +2 -2
  23. package/dist/modules/dom/customcontrol.js +2 -2
  24. package/dist/modules/dom/customelement.js +2 -2
  25. package/dist/modules/dom/events.js +2 -2
  26. package/dist/modules/dom/locale.js +2 -2
  27. package/dist/modules/dom/namespace.js +1 -1
  28. package/dist/modules/dom/template.js +2 -2
  29. package/dist/modules/dom/theme.js +2 -2
  30. package/dist/modules/dom/updater.js +2 -2
  31. package/dist/modules/dom/util.js +2 -2
  32. package/dist/modules/i18n/locale.js +2 -2
  33. package/dist/modules/i18n/namespace.js +1 -1
  34. package/dist/modules/i18n/provider.js +2 -2
  35. package/dist/modules/i18n/providers/fetch.js +2 -2
  36. package/dist/modules/i18n/providers/namespace.js +1 -1
  37. package/dist/modules/i18n/translations.js +2 -2
  38. package/dist/modules/logging/handler/console.js +2 -2
  39. package/dist/modules/logging/handler/namespace.js +1 -1
  40. package/dist/modules/logging/handler.js +2 -2
  41. package/dist/modules/logging/logentry.js +2 -2
  42. package/dist/modules/logging/logger.js +2 -2
  43. package/dist/modules/logging/namespace.js +1 -1
  44. package/dist/modules/math/namespace.js +1 -1
  45. package/dist/modules/math/random.js +2 -2
  46. package/dist/modules/monster.js +1 -1
  47. package/dist/modules/namespace.js +1 -1
  48. package/dist/modules/text/formatter.js +2 -2
  49. package/dist/modules/text/namespace.js +1 -1
  50. package/dist/modules/types/base.js +2 -2
  51. package/dist/modules/types/basewithoptions.js +2 -2
  52. package/dist/modules/types/global.js +2 -2
  53. package/dist/modules/types/id.js +2 -2
  54. package/dist/modules/types/is.js +2 -2
  55. package/dist/modules/types/namespace.js +1 -1
  56. package/dist/modules/types/observer.js +2 -2
  57. package/dist/modules/types/observerlist.js +2 -2
  58. package/dist/modules/types/proxyobserver.js +2 -2
  59. package/dist/modules/types/queue.js +2 -2
  60. package/dist/modules/types/randomid.js +2 -2
  61. package/dist/modules/types/stack.js +2 -2
  62. package/dist/modules/types/tokenlist.js +2 -2
  63. package/dist/modules/types/typeof.js +2 -2
  64. package/dist/modules/types/uniquequeue.js +2 -2
  65. package/dist/modules/types/validate.js +2 -2
  66. package/dist/modules/types/version.js +2 -2
  67. package/dist/modules/util/clone.js +2 -2
  68. package/dist/modules/util/comparator.js +2 -2
  69. package/dist/modules/util/freeze.js +2 -2
  70. package/dist/modules/util/namespace.js +1 -1
  71. package/dist/monster.dev.js +1096 -844
  72. package/dist/monster.dev.js.map +1 -1
  73. package/dist/monster.js +3 -3
  74. package/package.json +1 -1
  75. package/source/constants.js +6 -5
  76. package/source/constraints/abstract.js +2 -2
  77. package/source/constraints/abstractoperator.js +3 -3
  78. package/source/constraints/andoperator.js +7 -7
  79. package/source/constraints/invalid.js +6 -6
  80. package/source/constraints/isarray.js +6 -6
  81. package/source/constraints/isobject.js +6 -6
  82. package/source/constraints/oroperator.js +8 -8
  83. package/source/constraints/valid.js +6 -6
  84. package/source/data/buildmap.js +15 -15
  85. package/source/data/diff.js +6 -6
  86. package/source/data/extend.js +55 -13
  87. package/source/data/pathfinder.js +6 -7
  88. package/source/data/pipe.js +5 -5
  89. package/source/data/transformer.js +5 -6
  90. package/source/dom/assembler.js +5 -5
  91. package/source/dom/attributes.js +26 -26
  92. package/source/dom/constants.js +1 -2
  93. package/source/dom/customcontrol.js +14 -50
  94. package/source/dom/customelement.js +125 -28
  95. package/source/dom/events.js +7 -7
  96. package/source/dom/locale.js +5 -5
  97. package/source/dom/template.js +7 -7
  98. package/source/dom/theme.js +6 -6
  99. package/source/dom/updater.js +35 -13
  100. package/source/dom/util.js +9 -9
  101. package/source/i18n/locale.js +7 -7
  102. package/source/i18n/provider.js +5 -5
  103. package/source/i18n/providers/fetch.js +10 -10
  104. package/source/i18n/translations.js +5 -5
  105. package/source/logging/handler/console.js +4 -4
  106. package/source/logging/handler.js +4 -4
  107. package/source/logging/logentry.js +4 -4
  108. package/source/logging/logger.js +4 -4
  109. package/source/math/random.js +5 -5
  110. package/source/namespace.js +1 -1
  111. package/source/text/formatter.js +4 -5
  112. package/source/types/base.js +4 -5
  113. package/source/types/basewithoptions.js +9 -8
  114. package/source/types/global.js +6 -6
  115. package/source/types/id.js +6 -6
  116. package/source/types/is.js +22 -22
  117. package/source/types/observer.js +5 -5
  118. package/source/types/observerlist.js +4 -4
  119. package/source/types/proxyobserver.js +32 -26
  120. package/source/types/queue.js +13 -7
  121. package/source/types/randomid.js +5 -5
  122. package/source/types/stack.js +11 -4
  123. package/source/types/tokenlist.js +4 -4
  124. package/source/types/typeof.js +5 -5
  125. package/source/types/uniquequeue.js +11 -4
  126. package/source/types/validate.js +22 -22
  127. package/source/types/version.js +9 -9
  128. package/source/util/clone.js +4 -4
  129. package/source/util/comparator.js +6 -6
  130. package/source/util/freeze.js +4 -4
  131. package/test/cases/data/extend.js +66 -13
  132. package/test/cases/dom/customcontrol.js +16 -2
  133. package/test/cases/dom/customelement.js +64 -6
  134. package/test/cases/monster.js +1 -1
  135. package/test/cases/types/proxyobserver.js +9 -0
  136. package/test/web/monster-dev.html +3 -3
  137. package/test/web/monster.html +2 -2
  138. package/test/web/test.html +3 -3
  139. package/test/web/tests.js +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schukai/monster",
3
- "version": "1.14.1",
3
+ "version": "1.15.0",
4
4
  "description": "Monster is a simple library for creating fast, robust and lightweight websites.",
5
5
  "keywords": [
6
6
  "framework",
@@ -1,21 +1,22 @@
1
1
  'use strict';
2
2
 
3
- import {Monster} from "./namespace.js";
4
-
3
+ import {Monster} from './namespace.js';
5
4
  /**
6
5
  * Property-Keys
7
6
  * @author schukai GmbH
8
7
  */
9
8
 
10
9
  /**
10
+ * formerly known as PROPERTY_KEY_OPTIONS
11
+ *
11
12
  * @memberOf Monster
12
13
  * @type {string}
13
- * @since 1.10.0
14
+ * @since 1.15.0
14
15
  */
15
- const PROPERTY_KEY_OPTIONS = 'monsterOptions';
16
+ const PROPERTY_KEY_INTERNALDATA = 'monsterInternalData';
16
17
 
17
18
 
18
19
  export {
19
20
  Monster,
20
- PROPERTY_KEY_OPTIONS
21
+ PROPERTY_KEY_INTERNALDATA
21
22
  }
@@ -4,7 +4,7 @@
4
4
  * @author schukai GmbH
5
5
  */
6
6
 
7
- import {Monster} from '../namespace.js';
7
+ import {Monster, assignToNamespace} from '../namespace.js';
8
8
  import {Base} from '../types/base.js';
9
9
 
10
10
 
@@ -37,5 +37,5 @@ class AbstractConstraint extends Base {
37
37
  }
38
38
  }
39
39
 
40
- Monster.assignToNamespace('Monster.Constraints', AbstractConstraint);
40
+ assignToNamespace('Monster.Constraints', AbstractConstraint);
41
41
  export {Monster, AbstractConstraint}
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, AbstractConstraint} from "./abstract.js";
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import {AbstractConstraint} from "./abstract.js";
8
8
 
9
9
  /**
10
10
  * Operators allow you to link constraints together. for example, you can check whether a value is an object or an array. each operator has two operands that are linked together.
@@ -36,5 +36,5 @@ class AbstractOperator extends AbstractConstraint {
36
36
 
37
37
  }
38
38
 
39
- Monster.assignToNamespace('Monster.Constraints', AbstractOperator);
39
+ assignToNamespace('Monster.Constraints', AbstractOperator);
40
40
  export {Monster, AbstractOperator}
@@ -4,7 +4,7 @@
4
4
  * @author schukai GmbH
5
5
  */
6
6
 
7
- import {Monster, AbstractConstraint} from "./abstract.js";
7
+ import {Monster, assignToNamespace} from '../namespace.js';
8
8
  import {AbstractOperator} from "./abstractoperator.js";
9
9
 
10
10
  /**
@@ -12,7 +12,7 @@ import {AbstractOperator} from "./abstractoperator.js";
12
12
  *
13
13
  * ```
14
14
  * <script type="module">
15
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/andoperator.js';
15
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/andoperator.js';
16
16
  * new Monster.Constraint.AndOperator();
17
17
  * </script>
18
18
  * ```
@@ -21,16 +21,16 @@ import {AbstractOperator} from "./abstractoperator.js";
21
21
  *
22
22
  * ```
23
23
  * <script type="module">
24
- * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/andoperator.js';
24
+ * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/andoperator.js';
25
25
  * new AndOperator();
26
26
  * </script>
27
27
  * ```
28
28
  *
29
29
  * @example
30
30
  *
31
- * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/valid.js';
32
- * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/invalid.js';
33
- * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/andoperator.js';
31
+ * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/valid.js';
32
+ * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/invalid.js';
33
+ * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/andoperator.js';
34
34
  *
35
35
  * new AndOperator(
36
36
  * new Valid(), new Valid()).isValid()
@@ -62,5 +62,5 @@ class AndOperator extends AbstractOperator {
62
62
 
63
63
  }
64
64
 
65
- Monster.assignToNamespace('Monster.Constraints', AndOperator);
65
+ assignToNamespace('Monster.Constraints', AndOperator);
66
66
  export {Monster, AndOperator}
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, AbstractConstraint} from "./abstract.js";
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import {AbstractConstraint} from "./abstract.js";
8
8
 
9
9
  /**
10
10
  * The invalid constraint allows an always invalid query to be performed. this constraint is mainly intended for testing.
@@ -13,7 +13,7 @@ import {Monster, AbstractConstraint} from "./abstract.js";
13
13
  *
14
14
  * ```
15
15
  * <script type="module">
16
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/invalid.js';
16
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/invalid.js';
17
17
  * new Monster.Constraint.Invalid();
18
18
  * </script>
19
19
  * ```
@@ -22,14 +22,14 @@ import {Monster, AbstractConstraint} from "./abstract.js";
22
22
  *
23
23
  * ```
24
24
  * <script type="module">
25
- * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/invalid.js';
25
+ * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/invalid.js';
26
26
  * new Invalid();
27
27
  * </script>
28
28
  * ```
29
29
  *
30
30
  * @example
31
31
  *
32
- * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/invalid.js';
32
+ * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/invalid.js';
33
33
  *
34
34
  * new Invalid().isValid()
35
35
  * .then(()=>console.log(true))
@@ -54,5 +54,5 @@ class Invalid extends AbstractConstraint {
54
54
 
55
55
  }
56
56
 
57
- Monster.assignToNamespace('Monster.Constraints', Invalid);
57
+ assignToNamespace('Monster.Constraints', Invalid);
58
58
  export {Monster, Invalid}
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, AbstractConstraint} from "./abstract.js";
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import { AbstractConstraint} from "./abstract.js";
8
8
  import {isArray} from "../types/is.js";
9
9
 
10
10
  /**
@@ -12,7 +12,7 @@ import {isArray} from "../types/is.js";
12
12
  *
13
13
  * ```
14
14
  * <script type="module">
15
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/isarray.js';
15
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/isarray.js';
16
16
  * console.log(new Monster.Constraint.IsArray())
17
17
  * </script>
18
18
  * ```
@@ -21,14 +21,14 @@ import {isArray} from "../types/is.js";
21
21
  *
22
22
  * ```
23
23
  * <script type="module">
24
- * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/isarray.js';
24
+ * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/isarray.js';
25
25
  * console.log(new IsArray())
26
26
  * </script>
27
27
  * ```
28
28
  *
29
29
  * @example
30
30
  *
31
- * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/isarray.js';
31
+ * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/isarray.js';
32
32
  *
33
33
  * new IsArray()
34
34
  * .isValid([])
@@ -62,5 +62,5 @@ class IsArray extends AbstractConstraint {
62
62
 
63
63
  }
64
64
 
65
- Monster.assignToNamespace('Monster.Constraints', IsArray);
65
+ assignToNamespace('Monster.Constraints', IsArray);
66
66
  export {Monster, IsArray}
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, AbstractConstraint} from "./abstract.js";
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import {AbstractConstraint} from "./abstract.js";
8
8
  import {isObject} from "../types/is.js";
9
9
 
10
10
  /**
@@ -12,7 +12,7 @@ import {isObject} from "../types/is.js";
12
12
  *
13
13
  * ```
14
14
  * <script type="module">
15
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/isobject.js';
15
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/isobject.js';
16
16
  * console.log(new Monster.Constraint.IsObject())
17
17
  * </script>
18
18
  * ```
@@ -21,14 +21,14 @@ import {isObject} from "../types/is.js";
21
21
  *
22
22
  * ```
23
23
  * <script type="module">
24
- * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/isobject.js';
24
+ * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/isobject.js';
25
25
  * console.log(new IsObject())
26
26
  * </script>
27
27
  * ```
28
28
  *
29
29
  * @example
30
30
  *
31
- * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/isobject.js';
31
+ * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/isobject.js';
32
32
  *
33
33
  * new IsObject()
34
34
  * .isValid({})
@@ -63,5 +63,5 @@ class IsObject extends AbstractConstraint {
63
63
 
64
64
  }
65
65
 
66
- Monster.assignToNamespace('Monster.Constraints', IsObject);
66
+ assignToNamespace('Monster.Constraints', IsObject);
67
67
  export {Monster, IsObject}
@@ -3,15 +3,15 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, AbstractOperator} from "./abstractoperator.js";
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import { AbstractOperator} from "./abstractoperator.js";
8
8
 
9
9
  /**
10
10
  * The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled.
11
11
  *
12
12
  * ```
13
13
  * <script type="module">
14
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraint/oroperator.js';
14
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraint/oroperator.js';
15
15
  * new Monster.Constraint.OrOperator();
16
16
  * </script>
17
17
  * ```
@@ -20,16 +20,16 @@ import {Monster, AbstractOperator} from "./abstractoperator.js";
20
20
  *
21
21
  * ```
22
22
  * <script type="module">
23
- * import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraint/oroperator.js';
23
+ * import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraint/oroperator.js';
24
24
  * new OrOperator();
25
25
  * </script>
26
26
  * ```
27
27
  *
28
28
  * @example
29
29
  *
30
- * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/valid.js';
31
- * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/invalid.js';
32
- * import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/oroperator.js';
30
+ * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/valid.js';
31
+ * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/invalid.js';
32
+ * import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/oroperator.js';
33
33
  *
34
34
  * new OrOperator(
35
35
  * new Valid(), new Invalid()).isValid()
@@ -88,5 +88,5 @@ class OrOperator extends AbstractOperator {
88
88
 
89
89
  }
90
90
 
91
- Monster.assignToNamespace('Monster.Constraints', OrOperator);
91
+ assignToNamespace('Monster.Constraints', OrOperator);
92
92
  export {Monster, OrOperator}
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, AbstractConstraint} from "./abstract.js";
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import { AbstractConstraint} from "./abstract.js";
8
8
 
9
9
  /**
10
10
  * The valid constraint allows an always valid query to be performed. this constraint is mainly intended for testing.
@@ -13,7 +13,7 @@ import {Monster, AbstractConstraint} from "./abstract.js";
13
13
  *
14
14
  * ```
15
15
  * <script type="module">
16
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/valid.js';
16
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/valid.js';
17
17
  * new Monster.Constraint.Valid();
18
18
  * </script>
19
19
  * ```
@@ -22,14 +22,14 @@ import {Monster, AbstractConstraint} from "./abstract.js";
22
22
  *
23
23
  * ```
24
24
  * <script type="module">
25
- * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/valid.js';
25
+ * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/valid.js';
26
26
  * new Valid();
27
27
  * </script>
28
28
  * ```
29
29
  *
30
30
  * @example
31
31
  *
32
- * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/constraints/valid.js';
32
+ * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/constraints/valid.js';
33
33
  *
34
34
  * new Valid().isValid()
35
35
  * .then(()=>console.log(true))
@@ -54,5 +54,5 @@ class Valid extends AbstractConstraint {
54
54
 
55
55
  }
56
56
 
57
- Monster.assignToNamespace('Monster.Constraints', Valid);
57
+ assignToNamespace('Monster.Constraints', Valid);
58
58
  export {Monster, Valid}
@@ -4,7 +4,7 @@
4
4
  * @author schukai GmbH
5
5
  */
6
6
 
7
- import {Monster} from '../namespace.js';
7
+ import {Monster, assignToNamespace} from '../namespace.js';
8
8
  import {isFunction} from "../types/is.js";
9
9
  import {validateString} from "../types/validate.js";
10
10
  import {Pathfinder} from "./pathfinder.js";
@@ -19,7 +19,7 @@ import {Pathfinder} from "./pathfinder.js";
19
19
  *
20
20
  * ```
21
21
  * <script type="module">
22
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/data/buildmap.js';
22
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/buildmap.js';
23
23
  * console.log(Monster.Data.buildMap())
24
24
  * </script>
25
25
  * ```
@@ -28,7 +28,7 @@ import {Pathfinder} from "./pathfinder.js";
28
28
  *
29
29
  * ```
30
30
  * <script type="module">
31
- * import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/types/buildmap.js';
31
+ * import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/types/buildmap.js';
32
32
  * console.log(buildMap())
33
33
  * </script>
34
34
  * ```
@@ -90,8 +90,8 @@ import {Pathfinder} from "./pathfinder.js";
90
90
  * // '1' => 'Holly (952340 Schwalbach)',
91
91
  * // '2' => 'Guy (420729 Panchià)'
92
92
  * // }
93
- *
94
- * // a filter (function(value, key) {}) can be specified to accept only defined entries.
93
+ *
94
+ * // a filter (function(value, key) {}) can be specified to accept only defined entries.
95
95
  * map = buildMap(obj, 'data.*', '${name} (${address.zip} ${address.city})', 'id', function (value, key) {
96
96
  * return (value['id'] >= 20) ? true : false
97
97
  * });
@@ -104,12 +104,12 @@ import {Pathfinder} from "./pathfinder.js";
104
104
  *
105
105
  * @param {*} subject
106
106
  * @param {string} selector
107
- * @param {string|undefined} valuePath
108
- * @param {string|undefined} keyPath
109
- * @param {function|undefined} filter
107
+ * @param {string|undefined} valueTemplate
108
+ * @param {string|undefined} keyTemplate
109
+ * @param {function|undefined} filter
110
110
  * @return {*}
111
111
  */
112
- function buildMap(subject, selector, valuePath, keyPath, filter) {
112
+ function buildMap(subject, selector, valueTemplate, keyTemplate, filter) {
113
113
 
114
114
  validateString(selector);
115
115
  const result = new Map
@@ -123,12 +123,12 @@ function buildMap(subject, selector, valuePath, keyPath, filter) {
123
123
 
124
124
  map.forEach((v, k, m) => {
125
125
  if (isFunction(filter)) {
126
- if (filter.call(m, v, k)!==true) return;
126
+ if (filter.call(m, v, k) !== true) return;
127
127
  }
128
128
 
129
- k = build(v, keyPath, k);
130
- v = build(v, valuePath);
131
-
129
+ k = build(v, keyTemplate, k);
130
+ v = build(v, valueTemplate);
131
+
132
132
  result.set(k, v);
133
133
  });
134
134
 
@@ -146,7 +146,7 @@ function build(subject, definition, defaultValue) {
146
146
  if (definition === undefined) return defaultValue ? defaultValue : subject;
147
147
  validateString(definition);
148
148
 
149
- const regexp = /(?<placeholder>\$\{(?<path>[a-z.-_0-9]*)\})/gm
149
+ const regexp = /(?<placeholder>\${(?<path>[a-z.-_0-9]*)})/gm
150
150
  const array = [...definition.matchAll(regexp)];
151
151
 
152
152
  let finder = new Pathfinder(subject);
@@ -174,5 +174,5 @@ function build(subject, definition, defaultValue) {
174
174
  }
175
175
 
176
176
 
177
- Monster.assignToNamespace('Monster.Data', buildMap);
177
+ assignToNamespace('Monster.Data', buildMap);
178
178
  export {Monster, buildMap}
@@ -4,8 +4,8 @@
4
4
  * @author schukai GmbH
5
5
  */
6
6
 
7
-
8
- import {Monster, isArray, isObject} from "../types/is.js";
7
+ import {Monster, assignToNamespace} from '../namespace.js';
8
+ import { isArray, isObject} from "../types/is.js";
9
9
 
10
10
  /**
11
11
  * With the diff function you can perform the change of one object to another. The result shows the changes of the second object to the first object.
@@ -16,7 +16,7 @@ import {Monster, isArray, isObject} from "../types/is.js";
16
16
  *
17
17
  * ```
18
18
  * <script type="module">
19
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/data/diff.js';
19
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/diff.js';
20
20
  * console.log(Monster.Data.Diff(a, b))
21
21
  * </script>
22
22
  * ```
@@ -25,14 +25,14 @@ import {Monster, isArray, isObject} from "../types/is.js";
25
25
  *
26
26
  * ```
27
27
  * <script type="module">
28
- * import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/data/diff.js';
28
+ * import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/diff.js';
29
29
  * console.log(Diff(a, b))
30
30
  * </script>
31
31
  * ```
32
32
  *
33
33
  * @example
34
34
  *
35
- * import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/data/diff.js';
35
+ * import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/diff.js';
36
36
  *
37
37
  * // given are two objects x and y.
38
38
  *
@@ -244,5 +244,5 @@ function getOperator(a, b) {
244
244
 
245
245
  }
246
246
 
247
- Monster.assignToNamespace('Monster.Data', Diff);
247
+ assignToNamespace('Monster.Data', Diff);
248
248
  export {Monster, Diff}
@@ -3,15 +3,19 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, isObject} from "../types/is.js";
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import {isObject, isArray} from "../types/is.js";
8
+ import {typeOf} from "../types/typeof.js";
8
9
 
9
10
  /**
11
+ * extend copies all enumerable own properties from one or
12
+ * more source objects to a target object. It returns the modified target object.
13
+ *
10
14
  * You can call the method via the monster namespace `Monster.Data.extend()`.
11
15
  *
12
16
  * ```
13
17
  * <script type="module">
14
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/data/extend.js';
18
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/extend.js';
15
19
  * console.log(Monster.Data.extend(a, b))
16
20
  * </script>
17
21
  * ```
@@ -20,31 +24,69 @@ import {Monster, isObject} from "../types/is.js";
20
24
  *
21
25
  * ```
22
26
  * <script type="module">
23
- * import {extend} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/data/extend.js';
27
+ * import {extend} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/extend.js';
24
28
  * console.log(extend(a, b))
25
29
  * </script>
26
30
  * ```
27
31
  *
28
- * @param {object}
32
+ * @param {object} target
33
+ * @param {object}
29
34
  * @return {object}
30
35
  * @since 1.10.0
31
36
  * @copyright schukai GmbH
32
37
  * @memberOf Monster/Data
38
+ * @throws {Error} unsuported argument
39
+ * @throws {Error} type mismatch
33
40
  */
34
41
  function extend() {
42
+ let o, i;
43
+
44
+ for (i = 0; i < arguments.length; i++) {
45
+ let a = arguments[i];
46
+
47
+ if (!(isObject(a) || isArray(a))) {
48
+ throw new Error('unsuported argument ' + JSON.stringify(a));
49
+ }
35
50
 
36
- for (var o = {}, i = 0; i < arguments.length; i++) {
37
- if (!isObject(o)) continue;
38
- for (var k in arguments[i]) {
39
- if (arguments[i].hasOwnProperty(k)) {
40
- o[k] = isObject(arguments[i][k])
41
- ? extend(o[k] || {}, arguments[i][k])
42
- : arguments[i][k];
51
+ if (o === undefined) {
52
+ o = a;
53
+ continue;
54
+ }
55
+
56
+ for (let k in a) {
57
+
58
+ let v = a?.[k];
59
+
60
+ if(v===o?.[k]) {
61
+ continue;
43
62
  }
63
+
64
+ if ((isObject(v) || isArray(v))) {
65
+
66
+ if (o[k] === undefined) {
67
+ if (isArray(v)) {
68
+ o[k] = [];
69
+ } else {
70
+ o[k] = {};
71
+ }
72
+ }
73
+
74
+ if (typeOf(o[k]) !== typeOf(v)) {
75
+ throw new Error("type mismatch: " + JSON.stringify(o[k]) + " != " + JSON.stringify(v));
76
+ }
77
+
78
+ o[k] = extend(o[k], v);
79
+
80
+ } else {
81
+ o[k] = v;
82
+ }
83
+
44
84
  }
45
85
  }
86
+
46
87
  return o;
47
88
  }
48
89
 
49
- Monster.assignToNamespace('Monster.Data', extend);
90
+
91
+ assignToNamespace('Monster.Data', extend);
50
92
  export {Monster, extend}
@@ -3,8 +3,7 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster} from '../namespace.js';
6
+ import {Monster, assignToNamespace} from '../namespace.js';
8
7
  import {isObject, isArray, isInteger} from '../types/is.js';
9
8
  import {validateString, validateInteger} from '../types/validate.js';
10
9
  import {Base} from '../types/base.js';
@@ -28,7 +27,7 @@ const WILDCARD = '*';
28
27
  *
29
28
  * ```
30
29
  * <script type="module">
31
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/data/pathfinder.js';
30
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/pathfinder.js';
32
31
  * console.log(new Monster.Data.Pathfinder())
33
32
  * </script>
34
33
  * ```
@@ -37,7 +36,7 @@ const WILDCARD = '*';
37
36
  *
38
37
  * ```
39
38
  * <script type="module">
40
- * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/data/pathfinder.js';
39
+ * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/pathfinder.js';
41
40
  * console.log(new Pathfinder())
42
41
  * </script>
43
42
  * ```
@@ -79,7 +78,7 @@ const WILDCARD = '*';
79
78
  *
80
79
  * @example
81
80
  *
82
- * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/data/pathfinder.js';
81
+ * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/pathfinder.js';
83
82
  *
84
83
  * let value = new Pathfinder({
85
84
  * a: {
@@ -105,7 +104,7 @@ const WILDCARD = '*';
105
104
  *
106
105
  * @example
107
106
  *
108
- * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/data/pathfinder.js';
107
+ * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/pathfinder.js';
109
108
  *
110
109
  * let p = new Pathfinder({
111
110
  * a: {
@@ -226,7 +225,7 @@ class Pathfinder extends Base {
226
225
 
227
226
  }
228
227
 
229
- Monster.assignToNamespace('Monster.Data', Pathfinder);
228
+ assignToNamespace('Monster.Data', Pathfinder);
230
229
  export {Monster, Pathfinder}
231
230
 
232
231
  /**