silverwolf-x/project / packages /next /src /shared /lib /is-plain-object.ts
silverwolf-x's picture
download
raw
674 Bytes
export function getObjectClassLabel(value: any): string {
return Object.prototype.toString.call(value)
}
export function isPlainObject(value: any): boolean {
if (getObjectClassLabel(value) !== '[object Object]') {
return false
}
const prototype = Object.getPrototypeOf(value)
/**
* this used to be previously:
*
* `return prototype === null || prototype === Object.prototype`
*
* but Edge Runtime expose Object from vm, being that kind of type-checking wrongly fail.
*
* It was changed to the current implementation since it's resilient to serialization.
*/
return prototype === null || prototype.hasOwnProperty('isPrototypeOf')
}

Xet Storage Details

Size:
674 Bytes
·
Xet hash:
11ffd51dd8e48d1568d6e25ea50d04a7a3fbbe34d64329cba825761bf9e96193

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.