From ee142c69fd5ee51b38aac2a923caeb95192a52fd Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Fri, 27 Nov 2020 15:23:18 +1300 Subject: [PATCH] feat: don't clone by deafult re #212 --- changelog.md | 1 + readme.md | 6 ++---- src/options.ts | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 35da49a..5d3f10e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # [5.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v5.0.0) +- Breaking: Cloning is not turned off by default - Breaking: Endpoint are now exported in esm style [#215](https://github.com/TehShrike/deepmerge/pull/215) - The main merge function is now a default export - The all merge function is now exported as "deepmergeAll" and is no longer a property on the main merge function. diff --git a/readme.md b/readme.md index 26a5f14..27ee05b 100644 --- a/readme.md +++ b/readme.md @@ -251,11 +251,9 @@ result.pets // => ['Cat', 'Parrot', 'Dog'] #### `clone` -*Deprecated.* +Defaults to `false`. -Defaults to `true`. - -If `clone` is `false` then child objects will be copied directly instead of being cloned. This was the default behavior before version 2.x. +If `clone` is `true` then child objects will be cloned into the destination object instead of being directly copied. This was the default behavior before version 5.x. ## Testing diff --git a/src/options.ts b/src/options.ts index 48e3f88..5fc6df1 100644 --- a/src/options.ts +++ b/src/options.ts @@ -52,7 +52,7 @@ export type ObjectMerge = ( key: K ) => ((target: any, source: any, options: FullOptions) => any) | undefined -const defaultClone = true as const +const defaultClone = false as const function defaultIsMergeable(value: unknown): value is Record | Array { return Array.isArray(value) || isPlainObj(value)