Skip to content

Minor behaviour difference in cloneDeepWith compared to lodash-es #953

@filipsobol

Description

@filipsobol

Given the following code:

const data = cloneDeepWith( Object.create( null ) );
console.log( data.toString );

The object returned by lodash-es has an Object prototype, even though the original object was created using Object.create( null ), so the output to the console is [Function: toString]. However, the same function in es-toolkit/compat returns an object without a prototype, so the output to the console is undefined.

While the es-toolkit behavior makes more sense to me, you may consider this a bug if you care about full backward compatibility with lodash.


Reproduction: https://stackblitz.com/edit/node-e1e3y8ws?file=index.js

In the console, run node index.js.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions