Sha256: 4cadb632bb420f78a26f429187997b225aa2dbe718bba00c47c279f5ea997736
Contents?: true
Size: 695 Bytes
Versions: 43
Compression:
Stored size: 695 Bytes
Contents
import propName from './propName'; const DEFAULT_OPTIONS = { ignoreCase: true, }; /** * Returns the JSXAttribute itself or undefined, indicating the prop * is not present on the JSXOpeningElement. * */ export default function getProp(props = [], prop = '', options = DEFAULT_OPTIONS) { const propToFind = options.ignoreCase ? prop.toUpperCase() : prop; return props.find((attribute) => { // If the props contain a spread prop, then skip. if (attribute.type === 'JSXSpreadAttribute') { return false; } const currentProp = options.ignoreCase ? propName(attribute).toUpperCase() : propName(attribute); return propToFind === currentProp; }); }
Version data entries
43 entries across 43 versions & 1 rubygems