@dnax/core 0.6.1 → 0.6.3
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/app/hono.ts +4 -1
- package/package.json +1 -1
- package/utils/index.ts +17 -4
package/app/hono.ts
CHANGED
|
@@ -289,7 +289,10 @@ function HonoInstance(): typeof app {
|
|
|
289
289
|
c.req?.raw?.headers.get("content-type") ==
|
|
290
290
|
"application/x-www-form-urlencoded"
|
|
291
291
|
) {
|
|
292
|
-
parseBody =
|
|
292
|
+
parseBody =
|
|
293
|
+
(await c?.req.parseBody({
|
|
294
|
+
all: true,
|
|
295
|
+
})) || {};
|
|
293
296
|
}
|
|
294
297
|
|
|
295
298
|
const body = await c?.req
|
package/package.json
CHANGED
package/utils/index.ts
CHANGED
|
@@ -241,14 +241,27 @@ function omit(data: object[] | object, keysToRemove: string[]) {
|
|
|
241
241
|
*/
|
|
242
242
|
function pick(data: object | object[], keys: string[]): object {
|
|
243
243
|
const extractValues = (item) => {
|
|
244
|
-
|
|
244
|
+
const result = {};
|
|
245
|
+
keys.forEach((keyPath) => {
|
|
245
246
|
const keys = keyPath.split(".");
|
|
246
247
|
const value = keys.reduce((acc, key) => acc && acc[key], item);
|
|
247
248
|
if (value !== undefined) {
|
|
248
|
-
result
|
|
249
|
+
setDeepValue(result, keys, value);
|
|
249
250
|
}
|
|
250
|
-
|
|
251
|
-
|
|
251
|
+
});
|
|
252
|
+
return result;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const setDeepValue = (obj, keys, value) => {
|
|
256
|
+
let current = obj;
|
|
257
|
+
keys.forEach((key, index) => {
|
|
258
|
+
if (index === keys.length - 1) {
|
|
259
|
+
current[key] = value;
|
|
260
|
+
} else {
|
|
261
|
+
current[key] = current[key] || {};
|
|
262
|
+
current = current[key];
|
|
263
|
+
}
|
|
264
|
+
});
|
|
252
265
|
};
|
|
253
266
|
|
|
254
267
|
if (Array.isArray(data)) {
|