is-plain-object
is-plain-object copied to clipboard
Returns true if the given value is an object created by the Object constructor.
See [TS 4.7-rc Release Notes](https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-rc/#package-json-exports-imports-and-self-referencing) for details.
Breaking change: The typings now require TS v3.0 (released in 2018) due to switching `any` to `unknown`.
`isPlainObject(Object.create(null))` is supposed to be `true`
- performance improve: better to store prototype functions to variable to avoid lookup on each call; - reliability improve: prot.hasOwnProperty is not secure due it can be missing or redefined...
I have a plain JS object that is failing the check because it has an attribute called "constructor". But it is defined as a string. This should still be considered...
I added a test. If the constructor is a primitive, then this should still be considered a plain object because it isn't being created with a constructor.
## the wrong edition true when created by the Object constructor, or Object.create(null). ``` ... isPlainObject(null); //=> true ``` false when not created by the Object constructor. ``` ... isPlainObject(Object.create(null));...
If using TS with `moduleResolution `set to `node16`, `nodenext` or `bundler`, you get the following message: > Could not find a declaration file for module 'is-plain-object'. 'stackblitz:/node_modules/is-plain-object/dist/is-plain-object.mjs' implicitly has an...
Hello everyone, I recently started working with Next js, and to begin I took a pull of a sample next js [project](https://www.wrappixel.com/templates/monster-next-js-free-admin-template/?ref=157) . Now after doing npm install, and then...
Typescript complains it can't find the types when using ESM, so I updated the `exports` config to include `types` and it stopped complaining 👍. With this change type checking and...