adapt-authoring-api 3.5.0 → 3.6.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/lib/AbstractApiModule.js +2 -4
- package/package.json +1 -1
package/lib/AbstractApiModule.js
CHANGED
|
@@ -327,11 +327,9 @@ class AbstractApiModule extends AbstractModule {
|
|
|
327
327
|
* @return {Promise} Resolves with the sanitised data
|
|
328
328
|
*/
|
|
329
329
|
async sanitise (schemaName, data, options) {
|
|
330
|
+
const schema = await this.getSchema(schemaName, data)
|
|
330
331
|
const isArray = Array.isArray(data)
|
|
331
|
-
const sanitised =
|
|
332
|
-
const schema = await this.getSchema(schemaName, d)
|
|
333
|
-
return schema.sanitise(d, options)
|
|
334
|
-
}))
|
|
332
|
+
const sanitised = (isArray ? data : [data]).map(d => schema.sanitise(d, options))
|
|
335
333
|
return isArray ? sanitised : sanitised[0]
|
|
336
334
|
}
|
|
337
335
|
|