UNPKG

eslint-plugin-react-form-fields

Version:
13 lines (12 loc) 568 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isHiddenInput = void 0; const jsx_ast_utils_1 = require("jsx-ast-utils"); const getTagName_1 = require("./getTagName"); const isHiddenInput = (node) => { const tagName = (0, getTagName_1.getTagName)(node); const typeProp = (0, jsx_ast_utils_1.getProp)(node.openingElement.attributes, 'type'); const typePropValue = (0, jsx_ast_utils_1.getLiteralPropValue)(typeProp); return 'input' === tagName && 'hidden' === typePropValue; }; exports.isHiddenInput = isHiddenInput;