UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for static analysis and code manipulation.

37 lines (36 loc) 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var base_1 = require("../base"); var common_1 = require("../common"); exports.NamespaceImportBase = base_1.RenameableNode(common_1.Node); var NamespaceImport = /** @class */ (function (_super) { tslib_1.__extends(NamespaceImport, _super); function NamespaceImport() { return _super !== null && _super.apply(this, arguments) || this; } /** * Sets the name of the namespace import. */ NamespaceImport.prototype.setName = function (name) { var nameNode = this.getNameNode(); if (nameNode.getText() === name) return this; nameNode.replaceWithText(name); return this; }; /** * Gets the name of the namespace import. */ NamespaceImport.prototype.getName = function () { return this.getNameNode().getText(); }; /** * Gets the namespace import's name node. */ NamespaceImport.prototype.getNameNode = function () { return this._getNodeFromCompilerNode(this.compilerNode.name); }; return NamespaceImport; }(exports.NamespaceImportBase)); exports.NamespaceImport = NamespaceImport;