-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #448 from BeAPI/feat/js-optimization
Feat/js optimization
- Loading branch information
Showing
5 changed files
with
16 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,9 @@ | ||
/*! | ||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object> | ||
* isPlainObject <https://stackoverflow.com/questions/18531624/isplainobject-thing> | ||
* | ||
* Copyright (c) 2014-2017, Jon Schlinkert. | ||
* Released under the MIT License. | ||
* Copyright https://stackoverflow.com/users/6023279/trunow. | ||
*/ | ||
|
||
function isObject(o) { | ||
return Object.prototype.toString.call(o) === '[object Object]' | ||
} | ||
|
||
export default function isPlainObject(o) { | ||
let 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 | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (prot.hasOwnProperty('isPrototypeOf') === false) { | ||
return false | ||
} | ||
|
||
// Most likely a plain Object | ||
return true | ||
return o?.constructor === Object || Object.getPrototypeOf(o ?? 0) === null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters