ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
79 lines (77 loc) • 2.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const ts = require("typescript");
/** String characters */
var StringChar;
(function (StringChar) {
/** Double quote */
StringChar["DoubleQuote"] = "\"";
/** Single quote */
StringChar["SingleQuote"] = "'";
})(/* istanbul ignore next */StringChar = exports.StringChar || (exports.StringChar = {}));
/** Kinds of new lines */
var NewLineKind;
(function (NewLineKind) {
/** Line feed */
NewLineKind["LineFeed"] = "\n";
/** Carriage return and line feed */
NewLineKind["CarriageReturnLineFeed"] = "\r\n";
})(/* istanbul ignore next */NewLineKind = exports.NewLineKind || (exports.NewLineKind = {}));
/** Kinds of indentation */
var IndentationText;
(function (IndentationText) {
/** Two spaces */
IndentationText["TwoSpaces"] = " ";
/** Four spaces */
IndentationText["FourSpaces"] = " ";
/** Eight spaces */
IndentationText["EightSpaces"] = " ";
/** Tab */
IndentationText["Tab"] = "\t";
})(/* istanbul ignore next */IndentationText = exports.IndentationText || (exports.IndentationText = {}));
/**
* Holds the manipulation settings.
*/
class ManipulationSettingsContainer {
constructor() {
this.settings = {
indentationText: IndentationText.FourSpaces,
newLineKind: NewLineKind.LineFeed,
scriptTarget: ts.ScriptTarget.Latest,
stringChar: StringChar.DoubleQuote
};
}
/**
* Gets the string character.
*/
getStringChar() {
return this.settings.stringChar;
}
/**
* Gets the new line kind.
*/
getNewLineKind() {
return this.settings.newLineKind;
}
/**
* Gets the indentation text;
*/
getIndentationText() {
return this.settings.indentationText;
}
/**
* Gets the script target.
*/
getScriptTarget() {
return this.settings.scriptTarget;
}
/**
* Sets one or all of the settings.
* @param settings - Settings to set.
*/
set(settings) {
Object.assign(this.settings, settings);
}
}
exports.ManipulationSettingsContainer = ManipulationSettingsContainer;
//# sourceMappingURL=ManipulationSettings.js.map