@entryscape/rdforms 10.12.1 → 10.12.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.
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "application profile",
9
9
  "linked data"
10
10
  ],
11
- "version": "10.12.1",
11
+ "version": "10.12.3",
12
12
  "main": "dist/rdforms.node.js",
13
13
  "browser": "dist/rdforms.react.js",
14
14
  "module": "main.js",
@@ -264,7 +264,7 @@ export default class ItemStore {
264
264
  item.priority = this.priorities[source.property];
265
265
  }
266
266
  }
267
- if (id != null && this._registry[id] == null) {
267
+ if (id != null) {
268
268
  this._registry[id] = item;
269
269
  if (bundle != null) {
270
270
  bundle.addItem(item);
@@ -4,6 +4,16 @@ const matchRdfType = (item, type) => {
4
4
  const constr = item.getConstraints();
5
5
  return constr != null && constr[rdfType] === type;
6
6
  };
7
+
8
+ const arrayCompare = (arr1, arr2) => {
9
+ const _arr1 = Array.isArray(arr1) ? arr1 : (arr1 != null ? [arr1] : []);
10
+ const _arr2 = Array.isArray(arr2) ? arr2 : (arr2 != null ? [arr2] : []);
11
+ if (_arr1.length !== _arr2.length) {
12
+ return false;
13
+ }
14
+ return _arr1.every(v => _arr2.includes(v));
15
+ };
16
+
7
17
  const matchConstraint = (item, constraints) => {
8
18
  if (constraints == null) {
9
19
  return true;
@@ -15,11 +25,11 @@ const matchConstraint = (item, constraints) => {
15
25
  }
16
26
  Object.keys(constr).find((key) => {
17
27
  const c = constraints[key];
18
- if (c !== '' && c !== '*' && c !== constr[key]) {
19
- match = false;
20
- return true;
28
+ if (c === '' || c === '*' || arrayCompare(c, constr[key])) {
29
+ return false;
21
30
  }
22
- return false;
31
+ match = false;
32
+ return true;
23
33
  });
24
34
  return match;
25
35
  };