UNPKG

@typed-f/function

Version:

[![NPM Version][function-npm-version-badge]][function-npm] [repo-circleci-badge]: https://img.shields.io/circleci/project/github/Ailrun/typed-f/master.svg?logo=circleci [![Known Vulnerabilities][function-snyk-badge]][function-snyk] [![Supported TypeScript

16 lines (13 loc) 667 B
import { flip } from '@typed-f/function/dist/flip'; describe('flip', () => { it('should return a function that takes one argument two times when first argument is a function that takes one argument two times', () => { const test1 = (a: number) => (b: number) => a + b; expect(typeof flip(test1)).toBe('function'); expect(typeof flip(test1)(5)).toBe('function'); expect(flip(test1)(5)(1)).toBe(6); const test2 = (x: { [key: string]: number }) => (key: string) => x[key]; expect(typeof flip(test2)).toBe('function'); expect(typeof flip(test2)('myKey')).toBe('function'); expect(flip(test2)('myKey')({ myKey: 4 })).toBe(4); }); });