Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save anirudh-eka/42db1f9c5f87e2e0a52ef87e04f18fb4 to your computer and use it in GitHub Desktop.

Select an option

Save anirudh-eka/42db1f9c5f87e2e0a52ef87e04f18fb4 to your computer and use it in GitHub Desktop.

Revisions

  1. anirudh-eka created this gist Aug 5, 2018.
    9 changes: 9 additions & 0 deletions transducerBlogExtractReducersWithChain.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    const filterGreaterThan2AndMapAdd1Reducer = (a, x) => {
    if(x > 2) {
    return mapAdd1Reducer(a, x)
    } else {
    return a;
    }
    }

    [1, 2, 3].reduce(filterGreaterThan2AndMapAdd1Reducer, []);