Created
February 9, 2017 23:03
-
-
Save curtiswilkinson/22ca7a7bfe662eb5cd41d57dddff31c5 to your computer and use it in GitHub Desktop.
Currying + Partial Application
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
import * as api from 'whatever' | |
import * as R from 'ramda' | |
interface ReturnPayload { | |
name: string, | |
value: string | |
} | |
export function _saveAndProcessReturn(apiDep, payload) { | |
const saveReturn: ReturnPayload[] = apiDep.save('Route', payload) | |
return saveReturn.map(x => { | |
return { [x.name]: x.value } | |
}) | |
} | |
export const saveAndProcessReturn = R.curry(_saveAndProcessReturn)(api) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment