Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const _ = require('lodash');
const { DepGraph } = require('dependency-graph');
const Emittery = require('emittery');
const ow = require('ow');
const Queue = require('p-queue').default;
const v = require('./validators');
// Work around an annoying typo in a method name.
DepGraph.prototype.dependentsOf = DepGraph.prototype.dependantsOf;
module.exports = class TaskRunner extends Emittery {
constructor(context) {
super();
ow(context, ow.optional.object);
this._init(context);
}
_addOrRemoveTasks(tasks, func, action) {
func = _.bind(func, this);
if (Array.isArray(tasks)) {
tasks.forEach((task, i) => {
try {