perf: Use for loops while cloning classes
This commit is contained in:
@@ -178,7 +178,9 @@ export default class State {
|
||||
|
||||
clone(skipArrays?: boolean): State {
|
||||
const state = new State();
|
||||
Object.keys(this).forEach(key => {
|
||||
const keys = Object.keys(this);
|
||||
for (let i = 0, length = keys.length; i < length; i++) {
|
||||
const key = keys[i];
|
||||
// $FlowIgnore
|
||||
let val = this[key];
|
||||
|
||||
@@ -188,7 +190,8 @@ export default class State {
|
||||
|
||||
// $FlowIgnore
|
||||
state[key] = val;
|
||||
});
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user