Created
October 27, 2021 22:51
-
-
Save landonconover/4a3e58e257540ecde4a2a1d39abd85ef to your computer and use it in GitHub Desktop.
This file contains hidden or 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 _ from 'lodash' | |
| let hasBreed = | |
| _.curry((breed, obj) => obj.breed === breed) | |
| let dog = (name, size, bread) => | |
| `${name} is a ${size} dog that is a ${bread}` | |
| dog = _.curry(dog) | |
| // let dog = | |
| // name => | |
| // size => | |
| // breed => | |
| // `${name} is a ${size} dog that is a ${breed}` | |
| let landonDog = dog('ladon'); | |
| let landonSize = landonDog('small') | |
| let landonBreed = landonSize('lab') | |
| let landonNewSize = landonDog('large') | |
| landonBreed | |
| dog('landon')('small')('lab') //? | |
| let dogs = [ | |
| {name: 'Fido', breed: 'Lab'}, | |
| {name: 'Rex', breed: 'Lab'}, | |
| {name: 'Sparky', breed: 'Dalmatian'}, | |
| {name: 'Pooky', breed: 'Mini Yapper'} | |
| ] | |
| dogs.forEach((item, idx) => { | |
| item | |
| idx | |
| }) | |
| let labfilter = hasBreed('Lab') | |
| dogs.filter(labfilter) //? | |
| let newfunc = (name) => { | |
| name = name || 'landon' | |
| return name | |
| } | |
| newfunc('ryan') //? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment