UNPKG

graphinius

Version:

Generic graph library in Typescript

16 lines (15 loc) 350 B
/** * @param cbs * @param context this pointer to the DFS or DFSVisit function */ function execCallbacks(cbs : Array<Function>, context?) { cbs.forEach( function(cb) { if ( typeof cb === 'function' ) { cb(context); } else { throw new Error('Provided callback is not a function.'); } }); } export { execCallbacks };