function _breakCircularDeps(obj) {
    if (obj && typeof obj !== 'object') {
      return obj;
    }

    if (seen.has(obj)) {
      return '[Circular]';
    }

    seen.add(obj);
    for (const k in obj) {
      const descriptor = Object.getOwnPropertyDescriptor(obj, k);

      if (descriptor && descriptor.writable) {
        obj[k] = _breakCircularDeps(obj[k], k);
      }
    }

    // deleting means only a seen object that is its own child will be detected
    seen.delete(obj);
    return obj;
  }
Replaces any detected circular dependency with the string '[Circular]'
Mutates original object
@param inputObj {*}
@returns {*}