es-toolkit icon indicating copy to clipboard operation
es-toolkit copied to clipboard

Minor behaviour difference in `cloneDeepWith` compared to `lodash-es`

Open filipsobol opened this issue 9 months ago • 0 comments
trafficstars

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.

filipsobol avatar Feb 03 '25 10:02 filipsobol