MCPcopy
hub / github.com/csscomb/csscomb.js / configure

Method configure

src/core.js:41–74  ·  view source on GitHub ↗

* Loads configuration from JSON. * * @param {!Object} config * @return {!Comb}

(config)

Source from the content-addressed store, hash-verified

39 * @return {!Comb}
40 */
41 configure(config) {
42 if (typeof config !== 'object')
43 // TODO: throw error
44 throw new Error();
45
46 this.lint = config.lint;
47 this.verbose = config.verbose;
48 if (config.exclude)
49 this.exclude = config.exclude.map(function(pattern) {
50 return new minimatch.Minimatch(pattern);
51 });
52
53 if (config.syntax) {
54 for (let key in config.syntax) {
55 this.syntaxMap.set(key, config.syntax[key]);
56 }
57 }
58
59 for (let i = 0, l = this.plugins.length; i < l; i++) {
60 let plugin = this.plugins[i];
61 let name = plugin.name;
62 if (!config.hasOwnProperty(name)) continue;
63
64 try {
65 plugin.value = config[name];
66 this.config[name] = plugin.value;
67 } catch (e) {
68 // TODO: throw error
69 }
70 }
71
72 // Chaining.
73 return this;
74 }
75
76 /**
77 * Lints all files in a directory.

Callers 11

CSScombFunction · 0.95
constructorMethod · 0.80
useConfigMethod · 0.80
test.jsFile · 0.80
test.jsFile · 0.80
test.jsFile · 0.80
test.jsFile · 0.80
constructorMethod · 0.80
useConfigMethod · 0.80
test.jsFile · 0.80
cli.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected