@accordproject/concerto-core 2.0.0-20220328144946 → 2.0.0-20220401130011

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/changelog.txt CHANGED
@@ -24,7 +24,7 @@
24
24
  # Note that the latest public API is documented using JSDocs and is available in api.txt.
25
25
  #
26
26
 
27
- Version 2.0.0-alpha.1 {e7d26b02e1d17a58a1154fac957681b2} 2021-11-24
27
+ Version 2.0.0-alpha.1 {292b93fc879d3b0c3969711b24312ffd} 2022-03-30
28
28
  - Remove custom instanceof and add methods to check runtime type
29
29
  - Remove support for Node 12
30
30
  - Generate Typescript definitions from JSDoc
@@ -45,12 +45,13 @@ class DecoratorManager {
45
45
  }
46
46
 
47
47
  /**
48
- * Compares two values
48
+ * Compares two values. If the first argument is falsy
49
+ * the function returns true.
49
50
  * @param {string | null} test the value to test (lhs)
50
51
  * @param {string} value the value to compare (rhs)
51
52
  * @returns {Boolean} true if the lhs is falsy or test === value
52
53
  */
53
- static isMatch(test, value) {
54
+ static falsyOrEqual(test, value) {
54
55
  return test ? test === value : true;
55
56
  }
56
57
 
@@ -97,15 +98,15 @@ class DecoratorManager {
97
98
  */
98
99
  static executeCommand(namespace, declaration, command) {
99
100
  const { target, decorator, type } = command;
100
- if (this.isMatch(target.namespace, namespace) &&
101
- this.isMatch(target.declaration, declaration.name)) {
101
+ if (this.falsyOrEqual(target.namespace, namespace) &&
102
+ this.falsyOrEqual(target.declaration, declaration.name)) {
102
103
  if (!target.property && !target.type) {
103
104
  this.applyDecorator(declaration, type, decorator);
104
105
  }
105
106
  else {
106
107
  declaration.properties.forEach(property => {
107
- if (this.isMatch(target.property, property.name) &&
108
- this.isMatch(target.type, property.$class)) {
108
+ if (this.falsyOrEqual(target.property, property.name) &&
109
+ this.falsyOrEqual(target.type, property.$class)) {
109
110
  this.applyDecorator(property, type, decorator);
110
111
  }
111
112
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accordproject/concerto-core",
3
- "version": "2.0.0-20220328144946",
3
+ "version": "2.0.0-20220401130011",
4
4
  "description": "Core Implementation for the Concerto Modeling Language",
5
5
  "homepage": "https://github.com/accordproject/concerto",
6
6
  "engines": {
@@ -65,9 +65,9 @@
65
65
  "yargs": "17.3.1"
66
66
  },
67
67
  "dependencies": {
68
- "@accordproject/concerto-cto": "2.0.0-20220328144946",
69
- "@accordproject/concerto-metamodel": "2.0.0-20220328144946",
70
- "@accordproject/concerto-util": "2.0.0-20220328144946",
68
+ "@accordproject/concerto-cto": "2.0.0-20220401130011",
69
+ "@accordproject/concerto-metamodel": "2.0.0-20220401130011",
70
+ "@accordproject/concerto-util": "2.0.0-20220401130011",
71
71
  "dayjs": "1.10.8",
72
72
  "debug": "4.3.1",
73
73
  "lorem-ipsum": "2.0.3",
@@ -14,12 +14,13 @@ declare class DecoratorManager {
14
14
  */
15
15
  static decorateModels(modelManager: ModelManager, decoratorCommandSet: any): ModelManager;
16
16
  /**
17
- * Compares two values
17
+ * Compares two values. If the first argument is falsy
18
+ * the function returns true.
18
19
  * @param {string | null} test the value to test (lhs)
19
20
  * @param {string} value the value to compare (rhs)
20
21
  * @returns {Boolean} true if the lhs is falsy or test === value
21
22
  */
22
- static isMatch(test: string | null, value: string): boolean;
23
+ static falsyOrEqual(test: string | null, value: string): boolean;
23
24
  /**
24
25
  * Applies a decorator to a decorated model element.
25
26
  * @param {*} decorated the type to apply the decorator to