src/graph.js
function pruneNode(name) {
    const previousState = state;

    // If the node is still pending, invalidate the associated job so
    // that it becomes a no-op
    if (isNodePending(pendingJobs, name)) {
      invalidatePendingJobsForNode(pendingJobs, name);
    }

    if (isNodeDefined(state, name)) {
      let updatedState = previousState;

      const node = updatedState.get(name);

      node.dependents.forEach(dependent => {
        updatedState = removeEdge(updatedState, dependent, name);
      });

      node.dependencies.forEach(dependency => {
        updatedState = removeEdge(updatedState, name, dependency);
      });

      updatedState = removeNode(updatedState, name);

      state = updatedState;
    }

    signalIfCompleted();

    return Diff({
      from: previousState,
      to: state
    });
  }
function pruneNode(name) {
    const previousState = state;

    // If the node is still pending, invalidate the associated job so
    // that it becomes a no-op
    if (isNodePending(pendingJobs, name)) {
      invalidatePendingJobsForNode(pendingJobs, name);
    }

    if (isNodeDefined(state, name)) {
      let updatedState = previousState;

      const node = updatedState.get(name);

      node.dependents.forEach(dependent => {
        updatedState = removeEdge(updatedState, dependent, name);
      });

      node.dependencies.forEach(dependency => {
        updatedState = removeEdge(updatedState, name, dependency);
      });

      updatedState = removeNode(updatedState, name);

      state = updatedState;
    }

    signalIfCompleted();

    return Diff({
      from: previousState,
      to: state
    });
  }
function pruneNode ( name ) { const previousState = state ; // If the node is still pending, invalidate the associated job so // that it becomes a no-op if ( isNodePending ( pendingJobs , name ) ) { invalidatePendingJobsForNode ( pendingJobs , name ) ; } if ( isNodeDefined ( state , name ) ) { let updatedState = previousState ; const node = updatedState . get ( name ) ; node . dependents . forEach ( dependent => { updatedState = removeEdge ( updatedState , dependent , name ) ; } ) ; node . dependencies . forEach ( dependency => { updatedState = removeEdge ( updatedState , name , dependency ) ; } ) ; updatedState = removeNode ( updatedState , name ) ; state = updatedState ; } signalIfCompleted ( ) ; return Diff ( { from : previousState , to : state } ) ; }
Removes a node and its edges from the graph. Any pending jobs for the
node will be invalidated.

Be aware that pruning a single node may leave other nodes disconnected
from an entry node. You may want to call `pruneDisconnectedNodes` to
clean the graph of unwanted dependencies.

@param {String} name
@returns {Diff}
Removes a node and its edges from the graph . Any pending jobs for the node will be invalidated .