You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The last comment suggest, that { foo: 'bar' } is printed in the console. But it isn't, because createObj(original) mutates original, so both arguments of pickOriginal are the same mutated object.
I've run this on RunKit and, as expected, it returned {foo: "bar", id: "1625507940804"}.
But I don't think that is the biggest issue. The example doesn't actually shows, what this library does. Upon inspecting the code, I learned, that pickOriginal takes out fields existing on the object in the second argument from the object in the first argument, and returns the newly created object. The example in the readme doesn't show anything like that.
The text was updated successfully, but these errors were encountered:
I stumbled upon this library by accident, wasn't searching for it, but couldn't help but noticed, that the code in the example is flawed.
This is the example code in the README.md:
The last comment suggest, that
{ foo: 'bar' }
is printed in the console. But it isn't, becausecreateObj(original)
mutatesoriginal
, so both arguments ofpickOriginal
are the same mutated object.I've run this on RunKit and, as expected, it returned
{foo: "bar", id: "1625507940804"}
.But I don't think that is the biggest issue. The example doesn't actually shows, what this library does. Upon inspecting the code, I learned, that
pickOriginal
takes out fields existing on the object in the second argument from the object in the first argument, and returns the newly created object. The example in the readme doesn't show anything like that.The text was updated successfully, but these errors were encountered: