57a87050e7
* JSON.stringify generic errors * Add util for normalizing errors * lint-fix * Add better error for null case as well Co-authored-by: Michael Ozeryansky <mozeryansky@users.noreply.github.com>
12 lines
354 B
TypeScript
12 lines
354 B
TypeScript
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)
|
|
return prototype === null || prototype === Object.prototype
|
|
}
|