Created
August 31, 2018 17:20
-
-
Save aviladev/baeb65251904ebf9b48a37ff9985a7e4 to your computer and use it in GitHub Desktop.
An example for https://medium.com/@pacdiv/hi-roman-ostolosh-439c13969b38
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
'use strict' | |
const characters = [ | |
{ name: 'ironman', env: 'marvel' }, | |
{ name: 'black_widow', env: 'marvel' }, | |
{ name: 'wonder_woman', env: 'dc_comics' }, | |
] | |
characters | |
.filter( propEq('env', 'marvel') ) | |
.map( merge({ alsoSeenIn: ['Avengers'] }) ) | |
characters | |
.reduce((acc, character) => | |
propEq('env', 'marvel', character) | |
? acc.concat( merge({ alsoSeenIn: ['Avengers'] }, character) ) | |
: acc | |
, []) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment