Closed babs20 closed 1 month ago
Updated this to:
Also, it seems that there is a bit of different behavior from the is-plain-object
package compared to the suggested replacement. For example:
const { isPlainObject } = require('is-plain-object')
const arg = Object.create({});
console.log(isPlainObject(arg));
//=> true
console.log(arg && typeof arg === "object" && (Object.getPrototypeOf(arg) === null || Object.getPrototypeOf(arg) === Object.prototype))
//=> false
It appears to me that the suggested replacement from the module-replacements repo creates the "correct" output, so maybe down the road as this package matures we will need to be clear that this codemod (and possibly some others) could change the behavior of the code they are replacing.
This LGTM, @zloirock what do you think?
Nice work and great collaboration guys!
Codemod for
is-plain-object
using a slightly modified replacement from the module-replacements repo. I left an issue over there to address an edge case I encountered while creating this codemod. I am 99% confident in my variation, which matches the package's original behavior.