conductor
Why I'm building conductorGitHub
v1.5.0
v1.5.0
  • Introduction
  • Overview
    • Introduction
    • Core concepts
  • API reference
    • always
    • append
    • apply
    • arity
    • branch
    • capitalize
    • compose
    • concat
    • curry
    • curryN
    • delay
    • dump
    • entries
    • equals
    • equalsBy
    • factory
    • filter
    • findIndex
    • flatten
    • flip
    • forEach
    • get
    • head
    • ifElse
    • identity
    • into
    • isPromise
    • iterate
    • join
    • keys
    • map
    • merge
    • mergeBy
    • next
    • not
    • pluck
    • prepend
    • random
    • reduce
    • replace
    • slice
    • some
    • split
    • take
    • then
    • toLowerCase
    • transduce
    • transformers
      • transformers/filter
      • transformers/map
    • type
    • upsert
    • values
  • Guides
    • example use cases
    • checkGuards
Powered by GitBook
On this page
  • general description
  • some definitions
  • reducer
  • transformer
  • transducer
  1. API reference

transformers

general description

Transformers are utility function which decorate reducers: they take a reducer as input, and output another reducer, with added functionality. They are extremely useful when used with transduce, as they are very modular and thus easily composable.

some definitions

reducer

A reducer is a function whose role is to merge an item into an accumulator (a entity containing already merged values). Usually, a reducer is called several times while iterating over an iterable. For example, Array.prototype.push is a reducer: it takes an accumulator (the array) and an item, and merges the item into the array. In conductor, reducers have the following type signature:

reducer :: (Any accumulator, Any value, Any index, Collection collection) => Any value

transformer

A transformer is a function whose role is to decorate (add functionality) to a reducer. It accepts an input reducer, and outputs another reducer. Transformers have the following type signature:

transformer :: Reducer input => Reducer output

transducer

transducer :: (Transformer transformer, Reducer reducer, Any seed, Collection collection) => Any value
PrevioustransduceNexttransformers/filter

Last updated 7 years ago