forked from epicmaxco/vuestic-ui
-
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.
chore(compiler): disabled devtools by default and turn on config
- Loading branch information
Showing
4 changed files
with
51 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copied from ui/src/utils/merge-deep.ts | ||
|
||
const isObject = (obj: any) => obj && typeof obj === 'object' && !Array.isArray(obj) | ||
|
||
/** | ||
* Merge objects deep | ||
* If property is array, it will replace target value | ||
*/ | ||
export const mergeDeep = (target: any, source: any): any => { | ||
if (!isObject(target)) { | ||
target = {} | ||
} | ||
|
||
Object.keys(source).forEach(key => { | ||
const targetValue = target[key] | ||
const sourceValue = source[key] | ||
|
||
if (sourceValue instanceof RegExp || sourceValue instanceof Date) { | ||
target[key] = sourceValue | ||
} else if (isObject(targetValue) && isObject(sourceValue)) { | ||
target[key] = mergeDeep(Object.create( | ||
Object.getPrototypeOf(targetValue), | ||
Object.getOwnPropertyDescriptors(targetValue), | ||
), sourceValue) | ||
} else { | ||
target[key] = sourceValue | ||
} | ||
}) | ||
|
||
return target | ||
} | ||
|
||
export const mergeDeepMultiple = (...objects: any[]): any => { | ||
return objects.reduce((acc, obj) => mergeDeep(acc, obj), {}) | ||
} |
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