diff --git a/README.md b/README.md index 8630092..c63af52 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ logger.fatal(new Error("I am a pretty Error with a stacktrace.")); ## All Features - **Universal:** Works in browsers and Node.js -- **Tested:** 100% code coverage, CI +- **Tested:** Great code coverage, CI - **Super customizable:** Every aspect can be overwritten - **Fully typed:** Written in TypeScript, with native TypeScript support - **Default log level:** `silly`, `trace`, `debug`, `info`, `warn`, `error`, `fatal` (different colors) diff --git a/src/runtime/browser/util.inspect.polyfil.ts b/src/runtime/browser/util.inspect.polyfil.ts index c85de7b..9f15b1f 100644 --- a/src/runtime/browser/util.inspect.polyfil.ts +++ b/src/runtime/browser/util.inspect.polyfil.ts @@ -377,7 +377,8 @@ 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) { +function _extend(origin: object, add: object): object { + const typedOrigin = { ...origin } as { [key: string]: unknown }; // Don't do anything if add isn't an object if (!add || !isObject(add)) return origin; @@ -386,9 +387,9 @@ function _extend(origin: object, add: object) { const keys = Object.keys(add); let i = keys.length; while (i--) { - origin[keys[i]] = clonedAdd[keys[i]]; + typedOrigin[keys[i]] = clonedAdd[keys[i]]; } - return origin; + return typedOrigin; } export function formatWithOptions(inspectOptions: InspectOptions, ...args: unknown[]) {