UNPKG

@yobta/validator

Version:
27 lines (26 loc) 643 B
/*! * is-plain-object <https://github.com/jonschlinkert/is-plain-object> * * Copyright (c) 2014-2017, Jon Schlinkert. * Released under the MIT License. */ function isObject(value) { return Object.prototype.toString.call(value) === '[object Object]'; } export function isPlainObject(value) { if (!isObject(value)) { return false; } const ctor = value.constructor; if (!ctor) { return true; } const prot = ctor.prototype; if (!isObject(prot)) { return false; } if (!Object.prototype.hasOwnProperty.call(prot, 'isPrototypeOf')) { return false; } return true; }