-
-
Save Shuumatsu/03d9bc903f1e1daa08e43eac4400467c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('composes functions from right to left', () => { | |
const a = next => x => next(x + 'a') | |
const b = next => x => next(x + 'b') | |
const c = next => x => next(x + 'c') | |
const final = x => x | |
expect(compose(a, b, c)(final)('')).toBe('abc') | |
expect(compose(b, c, a)(final)('')).toBe('bca') | |
expect(compose(c, a, b)(final)('')).toBe('cab') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment