export function deepCopyFunction()

in src/devtools/views/StoreInspector/utils.js [13:41]


export function deepCopyFunction(inObject: any) {
  if (typeof inObject !== 'object' || inObject === null) {
    return inObject;
  }

  if (Array.isArray(inObject)) {
    const outObject = [];
    for (let i = 0; i < inObject.length; i++) {
      const value = inObject[i];
      outObject[i] = deepCopyFunction(value);
    }
    return outObject;
  } else if (inObject instanceof Map) {
    const outObject = new Map<mixed, mixed>();
    inObject.forEach((val, key) => {
      outObject.set(key, deepCopyFunction(val));
    });
    return outObject;
  } else {
    const outObject = {};
    for (const key in inObject) {
      const value = inObject[key];
      if (typeof key === 'string' && key != null) {
        outObject[key] = deepCopyFunction(value);
      }
    }
    return outObject;
  }
}