@acodeninja/persist 2.1.0 → 2.1.1

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": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "A JSON based data modelling and persistence module with alternate storage mechanisms.",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/type/Model.js CHANGED
@@ -118,9 +118,13 @@ export default class Model {
118
118
  }
119
119
 
120
120
  static isDryModel(possibleDryModel) {
121
- return (
122
- Object.keys(possibleDryModel).includes('id') &&
123
- !!possibleDryModel.id.match(/[A-Za-z]+\/[A-Z0-9]+/)
124
- );
121
+ try {
122
+ return (
123
+ Object.keys(possibleDryModel).includes('id') &&
124
+ !!possibleDryModel.id.match(/[A-Za-z]+\/[A-Z0-9]+/)
125
+ );
126
+ } catch (_) {
127
+ return false;
128
+ }
125
129
  }
126
130
  }
package/src/type/index.js CHANGED
@@ -7,6 +7,17 @@ import NumberType from './simple/NumberType.js';
7
7
  import SlugType from './resolved/SlugType.js';
8
8
  import StringType from './simple/StringType.js';
9
9
 
10
+ /**
11
+ * @class Type
12
+ * @property {StringType} String
13
+ * @property {NumberType} Number
14
+ * @property {BooleanType} Boolean
15
+ * @property {DateType} Date
16
+ * @property {ArrayType} Array
17
+ * @property {CustomType} Custom
18
+ * @property {ResolvedType} Resolved
19
+ * @property {Model} Model
20
+ */
10
21
  const Type = {};
11
22
 
12
23
  Type.String = StringType;
@@ -15,6 +26,11 @@ Type.Boolean = BooleanType;
15
26
  Type.Date = DateType;
16
27
  Type.Array = ArrayType;
17
28
  Type.Custom = CustomType;
29
+
30
+ /**
31
+ * @class ResolvedType
32
+ * @property {SlugType} Slug
33
+ */
18
34
  Type.Resolved = {Slug: SlugType};
19
35
  Type.Model = Model;
20
36