UNPKG

ern-api-gen

Version:

Electrode Native API generator

49 lines 1.37 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const File_1 = __importDefault(require("./File")); const minimatch_1 = require("minimatch"); const GLOB = 'glob:'; const glob = str => { str = str || '**'; const mm = new minimatch_1.Minimatch(str); return to => { const ret = mm.match(to); return ret; }; }; const match = str => { const f = new File_1.default(str).getAbsolutePath(); return to => { return new File_1.default(to).getAbsolutePath() === f; }; }; const EmptyMatcher = { matches() { return false; }, }; const FileSystems = { getDefault() { return { getPathMatcher(str) { if (str === GLOB) { return EmptyMatcher; } const matches = str.startsWith(GLOB) ? glob(str.substring(GLOB.length)) : match(str); return { matches, }; }, getPath(file) { return new File_1.default(file).getAbsolutePath(); }, }; }, }; exports.default = FileSystems; //# sourceMappingURL=FileSystems.js.map