How to use html-element-map - 1 common examples

To help you get started, we’ve selected a few html-element-map examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github airbnb / enzyme / packages / enzyme / src / selectors.js View on Github external
export function reduceTreeBySelector(selector, root) {
  if (typeof selector !== 'string') {
    const elements = elementsByConstructor(selector);
    if (elements.length > 0) {
      return flat(elements.map((x) => reduceTreeBySelector(x.tag, root)));

      // when https://github.com/aweary/rst-selector-parser/issues/15 is resolved
      // const htmlTagNames = elements.map(x => x.tag).join(', ');
      // return reduceTreeBySelector(htmlTagNames, root);
    }
  }

  if (typeof selector === 'function' || typeof selector === 'object') {
    return treeFilter(root, buildPredicate(selector));
  }

  let results = [];
  if (typeof selector === 'string') {
    const tokens = safelyGenerateTokens(selector);

html-element-map

Look up HTML tag names via HTML Element constructors, and vice versa.

MIT
Latest version published 4 years ago

Package Health Score

67 / 100
Full package analysis

Popular html-element-map functions