@onehat/data 1.21.1 → 1.21.2
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
package/src/Entity/Entity.js
CHANGED
|
@@ -1787,7 +1787,7 @@ class Entity extends EventEmitter {
|
|
|
1787
1787
|
* Helper to make sure this Repository is a tree
|
|
1788
1788
|
* @private
|
|
1789
1789
|
*/
|
|
1790
|
-
ensureTree =
|
|
1790
|
+
ensureTree = () => {
|
|
1791
1791
|
if (!this.isTree) {
|
|
1792
1792
|
this.throwError('This Entity is not a tree!');
|
|
1793
1793
|
return false;
|
|
@@ -1353,6 +1353,9 @@ export default class Repository extends EventEmitter {
|
|
|
1353
1353
|
this.throwError('this.getById is no longer valid. Repository has been destroyed.');
|
|
1354
1354
|
return;
|
|
1355
1355
|
}
|
|
1356
|
+
if (_.isNil(id)) {
|
|
1357
|
+
return null;
|
|
1358
|
+
}
|
|
1356
1359
|
return this.getFirstBy(entity => entity.id === id);
|
|
1357
1360
|
}
|
|
1358
1361
|
|
|
@@ -1366,12 +1369,15 @@ export default class Repository extends EventEmitter {
|
|
|
1366
1369
|
this.throwError('this.getIxById is no longer valid. Repository has been destroyed.');
|
|
1367
1370
|
return;
|
|
1368
1371
|
}
|
|
1372
|
+
if (_.isNil(id)) {
|
|
1373
|
+
return null;
|
|
1374
|
+
}
|
|
1369
1375
|
|
|
1370
1376
|
const ix = this.entities.findIndex((entity) => entity.id === id);
|
|
1371
1377
|
if (ix >= 0) {
|
|
1372
1378
|
return ix;
|
|
1373
1379
|
}
|
|
1374
|
-
return
|
|
1380
|
+
return null;
|
|
1375
1381
|
}
|
|
1376
1382
|
|
|
1377
1383
|
/**
|