From 6e8b3316a09848211bd81fc0de07f1802cd242f7 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Mon, 21 Oct 2019 11:40:08 -0400 Subject: [PATCH] remove the pipeline operator --- babel.config.js | 1 - package.json | 10 ++++------ src/index.js | 12 ++++++++---- src/splat.test.js | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/babel.config.js b/babel.config.js index 83a7a08..f037a1a 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,4 @@ module.exports = { -"plugins": [["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }]], presets: [ [ '@babel/preset-env', diff --git a/package.json b/package.json index f82b1b6..9541f23 100644 --- a/package.json +++ b/package.json @@ -4,16 +4,14 @@ "main": "index.js", "license": "MIT", "dependencies": { + "lodash": "^4.17.15", + "redux": "^4.0.4" + }, + "devDependencies": { "@babel/core": "^7.6.4", "@babel/preset-env": "^7.6.3", "babel-jest": "^24.9.0", "jest": "^24.9.0", - "lodash": "^4.17.15", - "memoize-getters": "^1.1.0", - "redux": "^4.0.4", "updeep": "^1.2.0" - }, - "devDependencies": { - "@babel/plugin-proposal-pipeline-operator": "^7.5.0" } } diff --git a/src/index.js b/src/index.js index ccd34b8..f84a08b 100644 --- a/src/index.js +++ b/src/index.js @@ -62,12 +62,16 @@ function buildMutations({mutations = {}, subduxes = {}}) { Object.entries(subduxes) ); - globby = globby |> fp.fromPairs |> fp.mapValues( + globby = + fp.flow([ + fp.fromPairs, + fp.mapValues( ({reducer}) => (_,action={}) => state => - reducer(state,action) ); + reducer(state,action) ), + ])(globby); const globbyMutation = (payload,action) => u( - globby |> fp.mapValues( mut => mut(payload,action) ) + fp.mapValues( mut => mut(payload,action) )(globby) ); actions.forEach( action => { @@ -86,7 +90,7 @@ function buildMutations({mutations = {}, subduxes = {}}) { mergedMutations[type].push(mutation); }); - return mergedMutations |> fp.mapValues( composeMutations ); + return fp.mapValues( composeMutations )(mergedMutations); } diff --git a/src/splat.test.js b/src/splat.test.js index 2fcea9e..57ac5bf 100644 --- a/src/splat.test.js +++ b/src/splat.test.js @@ -35,7 +35,7 @@ test( 'with subduxes', () => { bar: updux({ mutations: { foo: () => tracer('d'), - '*': (dummy,a) => { console.log( "got a ", dummy, a ); return tracer('e') }, + '*': (dummy,a) => tracer('e'), }, }), },