Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
3.0 KB
|
Line | |
---|
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 | exports.hasPropertyNameText = exports.getPropertyNameText = void 0;
|
---|
11 | const ts = require("typescript");
|
---|
12 | /**
|
---|
13 | * Gets the text of the given property name. Returns null if the property
|
---|
14 | * name couldn't be determined statically.
|
---|
15 | */
|
---|
16 | function getPropertyNameText(node) {
|
---|
17 | if (ts.isIdentifier(node) || ts.isStringLiteralLike(node)) {
|
---|
18 | return node.text;
|
---|
19 | }
|
---|
20 | return null;
|
---|
21 | }
|
---|
22 | exports.getPropertyNameText = getPropertyNameText;
|
---|
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 | exports.hasPropertyNameText = hasPropertyNameText;
|
---|
28 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvcGVydHktbmFtZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jZGsvc2NoZW1hdGljcy91cGRhdGUtdG9vbC91dGlscy9wcm9wZXJ0eS1uYW1lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7O0dBTUc7OztBQUVILGlDQUFpQztBQUtqQzs7O0dBR0c7QUFDSCxTQUFnQixtQkFBbUIsQ0FBQyxJQUFxQjtJQUN2RCxJQUFJLE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