rofrischmann/fela

View on GitHub
packages/fela-utils/src/processStyleWithPlugins.js

Summary

Maintainability
A
35 mins
Test Coverage
import { arrayReduce } from 'fast-loops'

export default function processStyleWithPlugins(
  renderer,
  style,
  type,
  props = {},
  plugins = renderer.plugins
) {
  if (plugins.length > 0) {
    return arrayReduce(
      plugins,
      (processedStyle, plugin) => plugin(processedStyle, type, renderer, props),
      style
    )
  }

  return style
}