"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var eventemitter3_1 = require("eventemitter3");
var micromatch = require("micromatch");
var isGlob = require('is-glob');
var api_1 = require("./api");
// utility logic for filesystem implementations
function getPathNodes(path) {
    return path.split(api_1.pathSeparator).filter(function (n) { return n.length !== 0; });
}
exports.getPathNodes = getPathNodes;
function extendMatchersWithGlob(paths) {
    return paths.reduce(function (extended, path) {
        extended.push(path);
        if (!isGlob(path)) {
            extended.push(path + "/**", "**/" + path, "**/" + path + "/**");
        }
        return extended;
    }, []);
}
function getIsIgnored(matchers, options) {
    if (options === void 0) { options = { dot: true }; }
    var patterns = extendMatchersWithGlob(matchers);
    return function (path) { return micromatch.any(path, patterns, options); };
}
exports.getIsIgnored = getIsIgnored;
function makeEventsEmitter() {
    return (new eventemitter3_1.EventEmitter());
}
exports.makeEventsEmitter = makeEventsEmitter;
//# sourceMappingURL=utils.js.map