@awesomeness-js/utils 1.2.8 → 1.2.9

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": "@awesomeness-js/utils",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "Awesomeness - Utils",
5
5
  "repository": {
6
6
  "type": "git",
@@ -132,7 +132,7 @@ function cleanArray(arr, schema = {}, {
132
132
 
133
133
  if(supposedToBeType === 'object'){
134
134
 
135
- cleanedItem = cleanObject(item, schema.properties, {
135
+ cleanedItem = cleanObject(item, schema.items, {
136
136
  testMode,
137
137
  allOrNothing,
138
138
  path: path ? `${path}.${key}` : key
@@ -134,6 +134,41 @@ const schemaForArrayOfObjects = {
134
134
  }
135
135
  };
136
136
 
137
+ const versesArray = [
138
+ {
139
+ book: 'GEN',
140
+ chapter: 1,
141
+ verse: 1,
142
+ },
143
+ {
144
+ book: 'PSA',
145
+ chapter: 23,
146
+ verse: 4,
147
+ }
148
+ ];
149
+
150
+ const versesSchema = {
151
+ type: 'array',
152
+ required: true,
153
+ items: {
154
+ type: 'object',
155
+ properties: {
156
+ book: {
157
+ type: 'string',
158
+ required: true
159
+ },
160
+ chapter: {
161
+ type: 'integer',
162
+ required: true
163
+ },
164
+ verse: {
165
+ type: 'integer',
166
+ required: true
167
+ }
168
+ }
169
+ }
170
+ };
171
+
137
172
  test('testStringArray', () => {
138
173
 
139
174
  const x = utils.clean.array(testStringArray, schemaForStrings);
@@ -197,4 +232,12 @@ test('schemaForArrayOfObjects', () => {
197
232
 
198
233
  expect(x).toStrictEqual(arrayOfObjects);
199
234
 
235
+ });
236
+
237
+ test('verses array of objects schema', () => {
238
+
239
+ const x = utils.clean.array(versesArray, versesSchema);
240
+
241
+ expect(x).toStrictEqual(versesArray);
242
+
200
243
  });