How to use the @tarojs/shared.isUndefined function in @tarojs/shared

To help you get started, we’ve selected a few @tarojs/shared 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 NervJS / taro / packages / taro-runtime / src / dom / style.ts View on Github external
})

    if (str === '') {
      return
    }

    const rules = str.split(';')

    for (let i = 0; i < rules.length; i++) {
      const rule = rules[i].trim()
      if (rule === '') {
        continue
      }

      const [propName, val] = rule.split(':')
      if (isUndefined(val)) {
        continue
      }
      this.setProperty(propName.trim(), val.trim())
    }
  }
github NervJS / taro / packages / taro-runtime / src / dom / event.ts View on Github external
export function createEvent (event: MpEvent, element: TaroElement) {
  const domEv = new TaroEvent(event.type, { bubbles: true, cancelable: true })
  for (const key in event) {
    if (key === 'currentTarget' || key === 'target') {
      domEv[key] = {
        ...event[key],
        ...event.detail
      }
    } else {
      domEv[key] = event[key]
    }
  }

  if (isUndefined(domEv.currentTarget)) {
    domEv.currentTarget = domEv.target
  }

  if (element.dataset !== EMPTY_OBJ) {
    domEv.currentTarget.dataset = { ...element.dataset }
  }

  return domEv
}
github NervJS / taro / packages / taro-runtime / src / dom / element.ts View on Github external
public hasAttribute (qualifiedName: string) {
    return !isUndefined(this.props[qualifiedName])
  }
github NervJS / taro / packages / taro-runtime / src / dom / style.ts View on Github external
public setProperty (propertyName: string, value?: string | null) {
    propertyName = toCamelCase(propertyName)
    if (isUndefined(value)) {
      return
    }

    if (value === null || value === '') {
      this.removeProperty(propertyName)
    } else {
      this[propertyName] = value
    }
  }