Last active
October 24, 2018 05:48
-
-
Save devdoomari3/f885f9f0a0e56cfd0556d471a7999169 to your computer and use it in GitHub Desktop.
ramda.ts
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
// 1. args-order matters: | |
import { map } from 'ramda' | |
type Person { | |
name: string | |
} | |
function getName(person: Person) { return person.name } | |
const getNames = map(getNames) // 1 liner with ramda | |
getNames([John, Jan, Jake]) | |
// Now, to make 'getNames' in lodash: | |
function getNames(persons: Person[]) { // 3 liner with lodash | |
return _.map(persons, getName) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment