Prune specific types of async hook resources from a collected map.
const prune = require('ah-prune')
// Removing all TickObject
const noticks = prune({ activities, prune: new Set([ 'TickObject' ]) })
// Removing everything but TCPWRAP
const onlytcpwrap = prune({ activities, keep: new Set([ 'TCPWRAP' ]) })
npm install ah-prune
Prunes the supplied async hook activities according to prune
or
keep
option.
It repoints the triggerIds in the process so that the graph is preserved.
Only either prune
or keep
maybe supplied at once.
The activities
passed are not modified, instead a clone is made before
the pruning step.
@param {Object} opts
options to configure the pruning step@param {Map.<Object>} opts.activities
the activities to be pruned@param {Set.<String>} opts.prune
if supplied all activities of types supplied in the Set are removed@param {Set.<String>} opts.keep
if supplied all activities of types NOT supplied in the Set are removed@return {Map.<Object>}
the pruned activities
MIT