Skip to content

Commit

Permalink
fix object extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubhruby committed Jul 10, 2024
1 parent c4e6ead commit 3b2486d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/runtime/browser/util.inspect.polyfil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,19 +377,18 @@ function reduceToSingleString(output: string[], base: string, braces: string[]):
return braces[0] + (base === "" ? "" : base + "\n") + " " + output.join(",\n ") + " " + braces[1];
}

function _extend(origin: object, add: object): object {
const typedOrigin = { ...origin } as { [key: string]: unknown };
function _extend(origin: object, add: object): void {
const typedOrigin = origin as {[key: string]: unknown};
// Don't do anything if add isn't an object
if (!add || !isObject(add)) return origin;
if (!add || !isObject(add)) return;

const clonedAdd = { ...add } as { [key: string]: unknown };
const clonedAdd = {...add} as {[key: string]: unknown};

const keys = Object.keys(add);
let i = keys.length;
while (i--) {
typedOrigin[keys[i]] = clonedAdd[keys[i]];
}
return typedOrigin;
}

export function formatWithOptions(inspectOptions: InspectOptions, ...args: unknown[]) {
Expand Down

0 comments on commit 3b2486d

Please sign in to comment.