From 6a5307aaab69aa816537ccdd28b24fe80fe609e5 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Tue, 13 Apr 2021 11:43:24 +0200 Subject: [PATCH] rename isObject to isConvertableObject and fix blob convertion --- src/util/utils.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/util/utils.ts b/src/util/utils.ts index bdb92103a..5bb7da7b6 100644 --- a/src/util/utils.ts +++ b/src/util/utils.ts @@ -51,9 +51,10 @@ function snakeToCamelCase(text: string) { ); } -function isObject(obj: unknown) { +function isConvertableObject(obj: unknown) { return ( - obj === Object(obj) && !Array.isArray(obj) && typeof obj !== "function" + obj === Object(obj) && !Array.isArray(obj) && typeof obj !== "function" && + !(obj instanceof Blob) ); } @@ -61,7 +62,7 @@ export function camelKeysToSnakeCase( // deno-lint-ignore no-explicit-any obj: Record | Record[], ): T { - if (isObject(obj)) { + if (isConvertableObject(obj)) { // deno-lint-ignore no-explicit-any const convertedObject: Record = {}; @@ -88,7 +89,7 @@ export function snakeKeysToCamelCase( // deno-lint-ignore no-explicit-any obj: Record | Record[], ): T { - if (isObject(obj)) { + if (isConvertableObject(obj)) { // deno-lint-ignore no-explicit-any const convertedObject: Record = {};