Unit_AI/node_modules/form-data-encoder/lib/esm/util/isPlainObject.js

14 lines
442 B
JavaScript
Raw Normal View History

2024-06-01 21:24:36 +01:00
const getType = (value) => (Object.prototype.toString.call(value).slice(8, -1).toLowerCase());
function isPlainObject(value) {
if (getType(value) !== "object") {
return false;
}
const pp = Object.getPrototypeOf(value);
if (pp === null || pp === undefined) {
return true;
}
const Ctor = pp.constructor && pp.constructor.toString();
return Ctor === Object.toString();
}
export default isPlainObject;