@acodeninja/persist 3.2.0-next.1 → 3.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acodeninja/persist",
3
- "version": "3.2.0-next.1",
3
+ "version": "3.2.0",
4
4
  "description": "A JSON based data modelling and persistence module with alternate storage mechanisms.",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/data/Model.js CHANGED
@@ -199,14 +199,17 @@ class Model {
199
199
  .filter(([name, type]) => {
200
200
  if (['indexedProperties', 'searchProperties'].includes(name)) return false;
201
201
 
202
+ /**
203
+ * Detect a one-to-one linked model
204
+ * @param maybeIncludesSingleModel
205
+ * @return {boolean}
206
+ */
202
207
  const includesSingleModel = (maybeIncludesSingleModel) => {
203
208
  if (maybeIncludesSingleModel._type === 'array') return false;
204
209
 
205
210
  if (Model.isModel(maybeIncludesSingleModel)) return true;
206
211
 
207
- if (maybeIncludesSingleModel._items?.some?.(i => ModelClass.isModel(i))) return true;
208
-
209
- return false;
212
+ return Boolean(maybeIncludesSingleModel._items?.some?.(i => ModelClass.isModel(i)));
210
213
  };
211
214
 
212
215
  if (includesSingleModel(type)) return true;