Skip to content

Commit

Permalink
feat: don't clone by deafult
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaStevens committed Nov 27, 2020
1 parent ec58b65 commit ee142c6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 2 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type ObjectMerge<K = any> = (
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<Property, unknown> | Array<unknown> {
return Array.isArray(value) || isPlainObj(value)
Expand Down

0 comments on commit ee142c6

Please sign in to comment.