canonical
Version:
Canonical code style linter and formatter for JavaScript, SCSS, CSS and JSON.
37 lines (27 loc) • 882 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _js = require('./../syntaxes/js');
var _json = require('./../syntaxes/json');
var _scss = require('./../syntaxes/scss');
exports.default = function (text, options) {
var result = void 0;
if (options.syntax === 'css') {
result = (0, _scss.fixText)(text);
} else if (options.syntax === 'js') {
result = (0, _js.fixText)(text);
} else if (options.syntax === 'json') {
result = (0, _json.fixText)(text);
} else if (options.syntax === 'scss') {
result = (0, _scss.fixText)(text);
} else {
throw new Error('Unknown syntax "' + options.syntax + '".');
}
if (options.filePath) {
result.filePath = options.filePath;
}
return result;
};
module.exports = exports['default'];
//# sourceMappingURL=fixText.js.map