moy-fp
Version:
A functional programming library.
24 lines (20 loc) • 593 B
JavaScript
import __ from '../../src/Function/__'
/**
* ((b, a) -> c) -> [b] -> [a] -> [c]
*/
import zipWith from '../../src/List/zipWith'
test('zipWith(not using __), the same length of two list', () => {
expect(
zipWith((b, a) => a + b)([4, 5, 6])([1, 2, 3])
).toEqual([5, 7, 9])
})
test('zipWith(not using __), not the same length of two list', () => {
expect(
zipWith((b, a) => a + b)([3, 4, 5])([1, 2])
).toEqual([4, 6])
})
test('zipWith(using __), the same length of two list', () => {
expect(
zipWith((b, a) => a + b, __, [1, 2, 3])([4, 5, 6])
).toEqual([5, 7, 9])
})