Skip to content

Commit

Permalink
Avoid using JSON.stringify in getDependencyArrayRef #39
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Nov 23, 2021
1 parent be3452c commit dcbb1c3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/tools/getDependencyArrayRef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@ export function getDependencyArrayRef(obj: any): any {
for (const key in obj) {
const value = obj[key];

const typeofValue = typeof value;

if (
!(
typeof value === "string" ||
(typeof value === "number" && !isNaN(value)) ||
typeof value === "boolean" ||
typeofValue === "string" ||
(typeofValue === "number" && !isNaN(value)) ||
typeofValue === "boolean" ||
value === undefined ||
value === null
)
) {
return obj;
}

arr.push(`${key}:${JSON.stringify(value)}`);
arr.push(`${key}:${typeofValue}_${value}`);
}

return "xSqLiJdLMd9s" + arr.join("|");
Expand Down

0 comments on commit dcbb1c3

Please sign in to comment.