property-name.js 922 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.io/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. const ts = require("typescript");
  11. /**
  12. * Gets the text of the given property name. Returns null if the property
  13. * name couldn't be determined statically.
  14. */
  15. function getPropertyNameText(node) {
  16. if (ts.isIdentifier(node) || ts.isStringLiteralLike(node)) {
  17. return node.text;
  18. }
  19. return null;
  20. }
  21. exports.getPropertyNameText = getPropertyNameText;
  22. /** Checks whether the given property name has a text. */
  23. function hasPropertyNameText(node) {
  24. return ts.isStringLiteral(node) || ts.isNumericLiteral(node) || ts.isIdentifier(node);
  25. }
  26. exports.hasPropertyNameText = hasPropertyNameText;
  27. //# sourceMappingURL=property-name.js.map