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

Method _parseString

src/core.js:345–372  ·  view source on GitHub ↗
(text, options)

Source from the content-addressed store, hash-verified

343 }
344
345 _parseString(text, options) {
346 let syntax = options && options.syntax;
347 let filename = options && options.filename || '';
348 let context = options && options.context;
349 let tree;
350 const lint = this.lint;
351
352 if (!text) return new Promise(function(resolve) {
353 resolve(lint ? [] : text);
354 });
355
356 if (!syntax) syntax = 'css';
357 this.syntax = syntax;
358
359 return new Promise(function(resolve) {
360 try {
361 tree = gonzales.parse(text, {syntax: syntax, rule: context});
362 resolve(tree, filename);
363 } catch (e) {
364 let version = require('../package.json').version;
365 let message = filename ? [filename] : [];
366 message.push(e.message);
367 message.push('CSScomb Core version: ' + version);
368 e.stack = e.message = message.join(os.EOL);
369 throw e;
370 }
371 });
372 }
373
374 _pluginAlreadyUsed(name) {
375 return this._pluginIndex(name) !== -1;

Callers 2

lintStringMethod · 0.95
processStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected