From d15e895669ce0a44c704755af39290700e73e85f Mon Sep 17 00:00:00 2001 From: Eli Perelman Date: Thu, 5 Oct 2017 16:42:29 -0500 Subject: [PATCH] Rename when arguments to be clearer --- README.md | 12 ++++++------ src/ChainedMap.js | 6 +++--- src/ChainedSet.js | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f2d3a80..c8052d8 100644 --- a/README.md +++ b/README.md @@ -208,11 +208,11 @@ merge(obj) ```js // Conditionally execute a function to continue configuration // condition: Boolean -// truthyHandler: Function -> ChainedMap +// whenTruthy: Function -> ChainedMap // invoked when condition is truthy, given a single argument of the ChainedMap instance -// falsyHandler: Function -> ChainedMap +// whenFalsy: Optional Function -> ChainedMap // invoked when condition is falsy, given a single argument of the ChainedMap instance -when(condition, truthyHandler, falsyHandler) +when(condition, whenTruthy, whenFalsy) ``` ## ChainedSet @@ -269,11 +269,11 @@ merge(arr) ```js // Conditionally execute a function to continue configuration // condition: Boolean -// truthyHandler: Function -> ChainedSet +// whenTruthy: Function -> ChainedSet // invoked when condition is truthy, given a single argument of the ChainedSet instance -// falsyHandler: Function -> ChainedSet +// whenFalsy: Optional Function -> ChainedSet // invoked when condition is falsy, given a single argument of the ChainedSet instance -when(condition, truthyHandler, falsyHandler) +when(condition, whenTruthy, whenFalsy) ``` ## Shorthand methods diff --git a/src/ChainedMap.js b/src/ChainedMap.js index 9ad90ec..72acb9c 100644 --- a/src/ChainedMap.js +++ b/src/ChainedMap.js @@ -82,11 +82,11 @@ module.exports = class extends Chainable { }, {}); } - when(condition, trueBrancher = Function.prototype, falseBrancher = Function.prototype) { + when(condition, whenTruthy = Function.prototype, whenFalsy = Function.prototype) { if (condition) { - trueBrancher(this); + whenTruthy(this); } else { - falseBrancher(this); + whenFalsy(this); } return this; diff --git a/src/ChainedSet.js b/src/ChainedSet.js index d95c462..100a0c4 100644 --- a/src/ChainedSet.js +++ b/src/ChainedSet.js @@ -39,11 +39,11 @@ module.exports = class extends Chainable { return this; } - when(condition, trueBrancher = Function.prototype, falseBrancher = Function.prototype) { + when(condition, whenTruthy = Function.prototype, whenFalsy = Function.prototype) { if (condition) { - trueBrancher(this); + whenTruthy(this); } else { - falseBrancher(this); + whenFalsy(this); } return this;