How to use property-information - 3 common examples

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);
github adobe / helix-pipeline / src / utils / hast-util-to-dom.js View on Github external
const key = props[i];

      const {
        attribute,
        property,
        // `mustUseAttribute`,
        mustUseProperty,
        boolean,
        booleanish,
        overloadedBoolean,
        // `number`,
        // `defined`,
        commaSeparated,
        // `spaceSeparated`,
        // `commaOrSpaceSeparated`,
      } = info.find(info.html, 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);
github wane / wane / src / compiler / analyzer / utils / prop-info.ts View on Github external
export function getPropInfoByPropName (propName: string): propInfo.PropInfo {
  const all = Object.values(propInfo.all)
  const prop = all.find(info => {
    return info.propertyName == propName
  })
  if (prop == null) {
    throw new Error(`Property "${propName}" does not exist.`)
  }
  return prop
}

property-information

Info on the properties and attributes of the web platform

MIT
Latest version published 12 days ago

Package Health Score

72 / 100
Full package analysis