How to use the editorconfig.parseFromFiles function in editorconfig

To help you get started, we’ve selected a few editorconfig examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RReverser / github-editorconfig / src / common / background.js View on Github external
global.getEditorConfig = function (path, callback) {
    var defaultConfig = ec.parseFromFiles(path.relative, [{
        name: pathUtils.resolve('.editorconfig'),
        contents: kango.storage.getItem('editorconfig') || ''
    }]);

    var repoConfig = ec.parse(pathUtils.join(path.root, path.relative), {
        root: path.root
    });

    Promise.settle([defaultConfig, repoConfig])
    .reduce(function (merged, current) {
        if (current.isFulfilled()) {
            current = current.value();
            for (var name in current) {
                merged[name] = current[name];
            }
        }