Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IXform<A, B>

Interface for types able to provide some internal functionality (or derive some related transformation) as Transducer. Implementations of this interface can be directly passed to all functions in this package where a Transducer arg is expected.

example
class Mul implements IXform<number, number> {
  constructor(public factor = 10) {}

  xform() { return map((x) => this.factor * x); }
}

transduce(new Mul(11), push(), range(4))
// [0, 11, 22, 33, 44]

// also usable w/ comp()
transduce(
  comp(
    drop(1),
    new Mul(11),
    takeNth(2)
  ),
  push(),
  range(4)
)
// [11, 33]

Type parameters

  • A

  • B

Hierarchy

  • IXform

Index

Methods

Methods

xform

  • Returns type specific operation as transducer. Internally called by functions in this package which expect transducer args. Users don't need to call this manually.

    Returns Transducer<A, B>

Generated using TypeDoc