123456789101112131415161718192021222324252627282930 |
- 'use strict';
- const {getStaticValue} = require('eslint-utils');
- function getPropertyName(node, scope) {
- const {type, property, computed} = node;
-
- if (type !== 'MemberExpression') {
- return;
- }
- if (!computed) {
- if (property.type === 'Identifier') {
- return property.name;
- }
-
- return;
- }
- const result = getStaticValue(property, scope);
- return result && result.value;
- }
- module.exports = getPropertyName;
|