dist/jsonpatcherproxy.js
/**
   * A callback to be used as the proxy delete trap callback.
   * It updates parenthood map if needed, calls default callbacks with the changes occurred.
   * @param {JSONPatcherProxy} instance JSONPatcherProxy instance
   * @param {Object} tree the effected object
   * @param {String} key the effected property's name
   */
A callback to be used as the proxy delete trap callback.
It updates parenthood map if needed, calls default callbacks with the changes occurred.
@param {JSONPatcherProxy} instance JSONPatcherProxy instance
@param {Object} tree the effected object
@param {String} key the effected property's name
A callback to be used as the proxy delete trap callback . It updates parenthood map if needed calls default callbacks with the changes occurred . @param { JSONPatcherProxy } instance JSONPatcherProxy instance @param { Object } tree the effected object @param { String } key the effected property ' s name
function trapForDeleteProperty(instance, tree, key) {
    const oldValue = tree[key];
    const reflectionResult = Reflect.deleteProperty(tree, key);
    if (typeof oldValue !== 'undefined') {
      const pathToKey = getPathToTree(instance, tree) + '/' + escapePathComponent(key);
      const subtreeMetadata = instance._treeMetadataMap.get(oldValue);
      if (subtreeMetadata) {
        if (subtreeMetadata.inherited) {
          subtreeMetadata.inherited = false;
        } else {
          instance._parenthoodMap.delete(subtreeMetadata.originalObject);
          instance._disableTrapsForTreeMetadata(subtreeMetadata);
          instance._treeMetadataMap.delete(oldValue);
        }
      }
      instance._defaultCallback({
        op: 'remove',
        path: pathToKey
      });
    }
    return reflectionResult;
  }
function trapForDeleteProperty ( instance , tree , key ) { const oldValue = tree [ key ] ; const reflectionResult = Reflect . deleteProperty ( tree , key ) ; if ( typeof oldValue !== 'undefined' ) { const pathToKey = getPathToTree ( instance , tree ) + '/' + escapePathComponent ( key ) ; const subtreeMetadata = instance . _treeMetadataMap . get ( oldValue ) ; if ( subtreeMetadata ) { if ( subtreeMetadata . inherited ) { subtreeMetadata . inherited = false ; } else { instance . _parenthoodMap . delete ( subtreeMetadata . originalObject ) ; instance . _disableTrapsForTreeMetadata ( subtreeMetadata ) ; instance . _treeMetadataMap . delete ( oldValue ) ; } } instance . _defaultCallback ( { op : 'remove' , path : pathToKey } ) ; } return reflectionResult ; }
A callback to be used as the proxy delete trap callback.
A callback to be used as the proxy delete trap callback .
/*
            this is an inherited proxy (an already proxified object that was moved around),
            we shouldn't revoke it, because even though it was removed from path1, it is still used in path2.
            And we know that because we mark moved proxies with `inherited` flag when we move them

            it is a good idea to remove this flag if we come across it here, in trapForDeleteProperty.
            We DO want to revoke the proxy if it was removed again.
          */