How to use the rambda.compose function in rambda

To help you get started, we’ve selected a few rambda 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 selfrefactor / rambda / files / failing_ramda_tests / compose.js View on Github external
it('performs right-to-left function composition', () => {
    //  f :: (String, Number?) -> ([Number] -> [Number])
    const f = R.compose(R.map, R.multiply, parseInt)
    eq(f.length, 2)
    eq(f('10')([ 1, 2, 3 ]), [ 10, 20, 30 ])
    eq(f('10', 2)([ 1, 2, 3 ]), [ 2, 4, 6 ])
  })
  it('passes context to functions', () => {
github selfrefactor / rambda / files / failing_ramda_tests / compose.js View on Github external
it('can be applied to one argument', () => {
    const f = function(a, b, c){ return [ a, b, c ] }
    const g = R.compose(f)
    eq(g.length, 3)
    eq(g(1, 2, 3), [ 1, 2, 3 ])
  })
})
github selfrefactor / rambda / files / failing_ramda_tests / compose.js View on Github external
jsv.property('associative', jsv.fn(), jsv.fn(), jsv.fn(), jsv.nat, (f, g, h, x) => {
    const result = f(g(h(x)))

    return R.all(R.equals(result), [
      R.compose(f, g, h)(x),
      R.compose(f, R.compose(g, h))(x),
      R.compose(R.compose(f, g), h)(x),
    ])
  })
})
github selfrefactor / rambda / files / failing_ramda_tests / compose.js View on Github external
jsv.property('associative', jsv.fn(), jsv.fn(), jsv.fn(), jsv.nat, (f, g, h, x) => {
    const result = f(g(h(x)))

    return R.all(R.equals(result), [
      R.compose(f, g, h)(x),
      R.compose(f, R.compose(g, h))(x),
      R.compose(R.compose(f, g), h)(x),
    ])
  })
})
github selfrefactor / rambda / files / failing_ramda_tests / compose.js View on Github external
jsv.property('associative', jsv.fn(), jsv.fn(), jsv.fn(), jsv.nat, (f, g, h, x) => {
    const result = f(g(h(x)))

    return R.all(R.equals(result), [
      R.compose(f, g, h)(x),
      R.compose(f, R.compose(g, h))(x),
      R.compose(R.compose(f, g), h)(x),
    ])
  })
})
github jpgorman / react-append-to-body / src / render-subtree.js View on Github external
function injectSubtree(registry, selector) {
  return compose(
    partial(appendToDOM, [selector]),
    reduce(
      (arrayOfElements, item) => (
        arrayOfElements.push(item.element), arrayOfElements
      ),
      []
    ),
    filter(propEq("selector", selector))
  )(covertToArray(registry))
}
github jpgorman / react-append-to-body / src / render-subtree.js View on Github external
function uniqueContainers(registry) {
  return compose(uniq, map(prop("selector")))(covertToArray(registry))
}