-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented the customization of styles of the Tooltip component
- Loading branch information
Showing
5 changed files
with
74 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
function deepCopy (obj) { | ||
const result = {} | ||
|
||
if (typeof obj !== 'object' | ||
|| typeof obj === 'undefined' | ||
|| obj === null | ||
|| Array.isArray(obj) | ||
|| typeof obj === 'function') { | ||
return obj | ||
} | ||
|
||
const keys = Object.keys(obj) | ||
|
||
// eslint-disable-next-line guard-for-in,no-restricted-syntax | ||
for (const key in keys) { | ||
result[keys[key]] = deepCopy(obj[keys[key]]) | ||
} | ||
|
||
return result | ||
} | ||
|
||
export function deepMerge (value1, value2) { | ||
const obj1 = deepCopy(value1) | ||
const obj2 = deepCopy(value2) | ||
const mergedObj = {} | ||
|
||
// eslint-disable-next-line no-restricted-syntax | ||
for (const key in obj1) { | ||
if (typeof obj1[key] === 'object' && obj1[key] !== null) { | ||
if (obj2[key] && typeof obj2[key] === 'object' && obj2[key] !== null) { | ||
mergedObj[key] = deepMerge(obj1[key], obj2[key]) | ||
} else { | ||
mergedObj[key] = obj1[key] | ||
} | ||
} else { | ||
mergedObj[key] = obj1[key] | ||
} | ||
} | ||
|
||
// eslint-disable-next-line no-restricted-syntax | ||
for (const key in obj2) { | ||
// eslint-disable-next-line no-prototype-builtins | ||
if (obj2.hasOwnProperty(key) && !obj1.hasOwnProperty(key)) { | ||
mergedObj[key] = obj2[key] | ||
} | ||
} | ||
|
||
return mergedObj | ||
} |