export default function(patterns, callback) {
    return new Promise(function(resolve, reject) {
        const chokidar = require('chokidar');

        chokidar
            .watch(patterns, { persistent: true })
            .on('change', callback)
            .on('error', reject);

        callback(patterns);
    });
}

export default function(patterns, callback) {
    return function watch(resolve, reject) {
        const chokidar = require('chokidar');

        chokidar
            .watch(patterns, { persistent: true })
            .on('change', function(file) {
                callback(file).catch(reject);
            })
            .on('error', reject);

        callback(patterns).catch(reject);
    };
}

refactor as Start task