@riddl/core 0.1.0 → 0.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/dist/utils.js +5 -0
- package/package.json +1 -1
package/dist/utils.js
CHANGED
|
@@ -3,6 +3,11 @@ export const recursiveAwait = (obj) => {
|
|
|
3
3
|
if (obj instanceof Promise) {
|
|
4
4
|
return obj.then(recursiveAwait);
|
|
5
5
|
}
|
|
6
|
+
else if (obj instanceof Date) {
|
|
7
|
+
// `Date` is an `Object`, but `Object.keys(new Date())` is [] — without this branch,
|
|
8
|
+
// dates become `{}` in API responses after the plain-object walk below.
|
|
9
|
+
return obj;
|
|
10
|
+
}
|
|
6
11
|
else if (obj instanceof Array) {
|
|
7
12
|
return Promise.all(obj.map(recursiveAwait));
|
|
8
13
|
}
|