mirror of
https://github.com/ASzc/change-string-case-action.git
synced 2024-11-23 22:43:51 +08:00
35 lines
762 B
JavaScript
35 lines
762 B
JavaScript
|
/*!
|
||
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||
|
*
|
||
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||
|
* Released under the MIT License.
|
||
|
*/
|
||
|
|
||
|
function isObject(o) {
|
||
|
return Object.prototype.toString.call(o) === '[object Object]';
|
||
|
}
|
||
|
|
||
|
function isPlainObject(o) {
|
||
|
var ctor,prot;
|
||
|
|
||
|
if (isObject(o) === false) return false;
|
||
|
|
||
|
// If has modified constructor
|
||
|
ctor = o.constructor;
|
||
|
if (ctor === undefined) return true;
|
||
|
|
||
|
// If has modified prototype
|
||
|
prot = ctor.prototype;
|
||
|
if (isObject(prot) === false) return false;
|
||
|
|
||
|
// If constructor does not have an Object-specific method
|
||
|
if (prot.hasOwnProperty('isPrototypeOf') === false) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
// Most likely a plain Object
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
export default isPlainObject;
|