Skip to content

Instantly share code, notes, and snippets.

@devdoomari3
Last active October 24, 2018 05:48
Show Gist options
  • Save devdoomari3/f885f9f0a0e56cfd0556d471a7999169 to your computer and use it in GitHub Desktop.
Save devdoomari3/f885f9f0a0e56cfd0556d471a7999169 to your computer and use it in GitHub Desktop.
ramda.ts
// 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