mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-10-12 22:11:58 +00:00
Add experiments system. Add experiments UI. Update disabled buttons to use tw-button--disabled. Update chat line rendering. Add preset emote sizes to the emote menu to reduce reflows when loading. Fix directory issues caused by fixes to route sorting. Update the theme. Add a current route name value to fine router. Add recursive object protection to deep_copy.
This commit is contained in:
parent
1841ab156c
commit
e3a7e3b64d
35 changed files with 1075 additions and 451 deletions
|
@ -185,19 +185,27 @@ export function get(path, object) {
|
|||
}
|
||||
|
||||
|
||||
export function deep_copy(object) {
|
||||
export function deep_copy(object, seen) {
|
||||
if ( typeof object !== 'object' )
|
||||
return object;
|
||||
|
||||
if ( ! seen )
|
||||
seen = new Set;
|
||||
|
||||
if ( seen.has(object) )
|
||||
throw new Error('recursive structure detected');
|
||||
|
||||
seen.add(object);
|
||||
|
||||
if ( Array.isArray(object) )
|
||||
return object.map(deep_copy);
|
||||
return object.map(x => deep_copy(x, seen));
|
||||
|
||||
const out = {};
|
||||
for(const key in object)
|
||||
if ( HOP.call(object, key) ) {
|
||||
const val = object[key];
|
||||
if ( typeof val === 'object' )
|
||||
out[key] = deep_copy(val);
|
||||
out[key] = deep_copy(val, seen);
|
||||
else
|
||||
out[key] = val;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue