Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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', () => {
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 ])
})
})
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),
])
})
})
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),
])
})
})
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),
])
})
})
function injectSubtree(registry, selector) {
return compose(
partial(appendToDOM, [selector]),
reduce(
(arrayOfElements, item) => (
arrayOfElements.push(item.element), arrayOfElements
),
[]
),
filter(propEq("selector", selector))
)(covertToArray(registry))
}
function uniqueContainers(registry) {
return compose(uniq, map(prop("selector")))(covertToArray(registry))
}