canonical
Version:
Canonical code style linter and formatter for JavaScript, SCSS, CSS and JSON.
39 lines (28 loc) • 968 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) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var result = undefined;
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