textlint-rule-editorconfig
Version:
Let EditorConfig and Textlint works together.
12 lines (9 loc) • 321 B
JavaScript
const Minimatch = require('minimatch').Minimatch;
const path = require('path');
const isBasenamePattern = (str) => str.indexOf('/') === -1;
module.exports = (pattern) => {
const mm = new Minimatch(pattern);
return isBasenamePattern(pattern) ?
(file) => mm.match(path.basename(file)) :
mm.match.bind(mm);
};