vike
Version:
The Framework *You* Control - Next.js & Nuxt alternative for unprecedented flexibility and dependability.
17 lines (16 loc) • 422 B
JavaScript
export function isPlainObject(value) {
// Is object?
if (typeof value !== 'object' || value === null) {
return false;
}
// Support `Object.create(null)`
if (Object.getPrototypeOf(value) === null) {
return true;
}
// Is plain object?
return (
/* Doesn't work in Cloudflare Pages workers
value.constructor === Object
*/
value.constructor.name === 'Object');
}