UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

72 lines (71 loc) 2.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ts = require("typescript"); var objectAssign = require("object-assign"); var compiler_1 = require("./compiler"); /** 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. */ var ManipulationSettingsContainer = /** @class */ (function () { function ManipulationSettingsContainer() { this.settings = { indentationText: IndentationText.FourSpaces, newLineKind: NewLineKind.LineFeed, scriptTarget: ts.ScriptTarget.Latest, quoteType: compiler_1.QuoteType.Double }; } /** * Gets the quote type used for string literals. */ ManipulationSettingsContainer.prototype.getQuoteType = function () { return this.settings.quoteType; }; /** * Gets the new line kind. */ ManipulationSettingsContainer.prototype.getNewLineKind = function () { return this.settings.newLineKind; }; /** * Gets the indentation text; */ ManipulationSettingsContainer.prototype.getIndentationText = function () { return this.settings.indentationText; }; /** * Gets the script target. */ ManipulationSettingsContainer.prototype.getScriptTarget = function () { return this.settings.scriptTarget; }; /** * Sets one or all of the settings. * @param settings - Settings to set. */ ManipulationSettingsContainer.prototype.set = function (settings) { objectAssign(this.settings, settings); }; return ManipulationSettingsContainer; }()); exports.ManipulationSettingsContainer = ManipulationSettingsContainer;