How to use the fela-utils.arrayEach function in fela-utils

To help you get started, we’ve selected a few fela-utils 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 robinweser / fela / packages / fela-plugin-extend / src / index.js View on Github external
objectEach(style, (value, property) => {
    if (property === 'extend') {
      const extensions = [].concat(value)

      arrayEach(extensions, extension =>
        extendStyle(style, extension, extend, renderer)
      )
      delete style[property]
    } else if (isObject(value)) {
      // support nested extend as well
      style[property] = extend(value, type, renderer)
    }
  })
github robinweser / fela / packages / fela-dom / src / dom / rehydration / rehydrateCache.js View on Github external
export default function rehydrateCache(renderer: DOMRenderer): void {
  if (renderer.enableRehydration) {
    arrayEach(document.querySelectorAll('[data-fela-type]'), node => {
      const type = node.getAttribute('data-fela-type') || ''
      const media = node.getAttribute('media') || ''
      const css = node.textContent

      const handler = rehydrationHandlers[type]

      if (handler) {
        handler(renderer, css, media)
      }
    })
  }
}