mirror of
https://github.com/diligencia/semantic-branch-version.git
synced 2024-11-23 23:13:51 +08:00
47 lines
1.0 KiB
JavaScript
47 lines
1.0 KiB
JavaScript
|
/*!
|
||
|
* isobject <https://github.com/jonschlinkert/isobject>
|
||
|
*
|
||
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||
|
* Released under the MIT License.
|
||
|
*/
|
||
|
|
||
|
function isObject(val) {
|
||
|
return val != null && typeof val === 'object' && Array.isArray(val) === false;
|
||
|
}
|
||
|
|
||
|
/*!
|
||
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||
|
*
|
||
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||
|
* Released under the MIT License.
|
||
|
*/
|
||
|
|
||
|
function isObjectObject(o) {
|
||
|
return isObject(o) === true
|
||
|
&& Object.prototype.toString.call(o) === '[object Object]';
|
||
|
}
|
||
|
|
||
|
function isPlainObject(o) {
|
||
|
var ctor,prot;
|
||
|
|
||
|
if (isObjectObject(o) === false) return false;
|
||
|
|
||
|
// If has modified constructor
|
||
|
ctor = o.constructor;
|
||
|
if (typeof ctor !== 'function') return false;
|
||
|
|
||
|
// If has modified prototype
|
||
|
prot = ctor.prototype;
|
||
|
if (isObjectObject(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;
|