lib/index.js
function finalize(base, path, patches, inversePatches) {
      if (isProxy(base)) {
          var state = base[PROXY_STATE];
          if (state.modified === true) {
              if (state.finalized === true) return state.copy;
              state.finalized = true;
              var result = finalizeObject(useProxies ? state.copy : state.copy = shallowCopy(base), state, path, patches, inversePatches);
              generatePatches(state, path, patches, inversePatches, state.base, result);
              return result;
          } else {
              return state.base;
          }
      }
      finalizeNonProxiedObject(base);
      return base;
  }
function finalize(base, path, patches, inversePatches) {
      if (isProxy(base)) {
          var state = base[PROXY_STATE];
          if (state.modified === true) {
              if (state.finalized === true) return state.copy;
              state.finalized = true;
              var result = finalizeObject(useProxies ? state.copy : state.copy = shallowCopy(base), state, path, patches, inversePatches);
              generatePatches(state, path, patches, inversePatches, state.base, result);
              return result;
          } else {
              return state.base;
          }
      }
      finalizeNonProxiedObject(base);
      return base;
  }
function finalize ( base , path , patches , inversePatches ) { if ( isProxy ( base ) ) { var state = base [ PROXY_STATE ] ; if ( state . modified === true ) { if ( state . finalized === true ) return state . copy ; state . finalized = true ; var result = finalizeObject ( useProxies ? state . copy : state . copy = shallowCopy ( base ) , state , path , patches , inversePatches ) ; generatePatches ( state , path , patches , inversePatches , state . base , result ) ; return result ; } else { return state . base ; } } finalizeNonProxiedObject ( base ) ; return base ; }
given a base object, returns it if unmodified, or return the changed cloned if modified
given a base object returns it if unmodified or return the changed cloned if modified