How to use the property-information/find function in property-information

To help you get started, we’ve selected a few property-information 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 syntax-tree / hast-util-to-dom / src / index.js View on Github external
const key = props[i];

    const {
      attribute,
      property,
      // `mustUseAttribute`,
      mustUseProperty,
      boolean,
      booleanish,
      overloadedBoolean,
      // `number`,
      // `defined`,
      commaSeparated,
      // `spaceSeparated`,
      // `commaOrSpaceSeparated`,
    } = find(schema, key);

    let value = properties[key];

    if (Array.isArray(value)) {
      value = value.join(commaSeparated ? ', ' : ' ');
    }

    if (mustUseProperty) {
      el[property] = value;
    }

    if (boolean || (overloadedBoolean && typeof value === 'boolean')) {
      if (value) {
        el.setAttribute(attribute, '');
      } else {
        el.removeAttribute(attribute);

property-information

Info on the properties and attributes of the web platform

MIT
Latest version published 2 months ago

Package Health Score

72 / 100
Full package analysis