property-name.js 923 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright Google LLC All Rights Reserved.
  5. *
  6. * Use of this source code is governed by an MIT-style license that can be
  7. * found in the LICENSE file at https://angular.dev/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. exports.getPropertyNameText = getPropertyNameText;
  11. exports.hasPropertyNameText = hasPropertyNameText;
  12. const ts = require("typescript");
  13. /**
  14. * Gets the text of the given property name. Returns null if the property
  15. * name couldn't be determined statically.
  16. */
  17. function getPropertyNameText(node) {
  18. if (ts.isIdentifier(node) || ts.isStringLiteralLike(node)) {
  19. return node.text;
  20. }
  21. return null;
  22. }
  23. /** Checks whether the given property name has a text. */
  24. function hasPropertyNameText(node) {
  25. return ts.isStringLiteral(node) || ts.isNumericLiteral(node) || ts.isIdentifier(node);
  26. }
  27. //# sourceMappingURL=property-name.js.map