@difizen/mana-common
Version:
26 lines • 1.13 kB
JavaScript
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
export var noop = function noop() {
//
};
export function getPropertyDescriptor(o, propertyName) {
var proto = o;
var descriptor = undefined;
while (proto && !descriptor) {
descriptor = Object.getOwnPropertyDescriptor(proto, propertyName);
proto = Object.getPrototypeOf(proto);
}
return descriptor;
}
export function isPlainObject(obj) {
if (_typeof(obj) !== 'object' || obj === null ||
// window/navigator/Global
Object.prototype.toString.call(obj) !== '[object Object]') {
return false;
}
var proto = Object.getPrototypeOf(obj);
if (proto === null) {
return true;
}
var ctor = Object.prototype.hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof ctor === 'function' && ctor instanceof ctor && ctor.toString() === Object.toString();
}