source: frontend/node_modules/eslint-plugin-jsx-a11y/lib/util/isNonLiteralProperty.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.0 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports["default"] = void 0;
7var _jsxAstUtils = require("jsx-ast-utils");
8/**
9 * Returns boolean indicating whether the given element has been specified with
10 * an AST node with a non-literal type.
11 *
12 * Returns true if the elements has a role and its value is not of a type Literal.
13 * Otherwise returns false.
14 */
15var isNonLiteralProperty = function isNonLiteralProperty(attributes, propName) {
16 var prop = (0, _jsxAstUtils.getProp)(attributes, propName);
17 if (!prop) return false;
18 var propValue = prop.value;
19 if (!propValue) return false;
20 if (propValue.type === 'Literal') return false;
21 if (propValue.type === 'JSXExpressionContainer') {
22 var expression = propValue.expression;
23 if (expression.type === 'Identifier' && expression.name === 'undefined') return false;
24 if (expression.type === 'JSXText') return false;
25 }
26 return true;
27};
28var _default = exports["default"] = isNonLiteralProperty;
29module.exports = exports.default;
Note: See TracBrowser for help on using the repository browser.