Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Rename when arguments to be clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
eliperelman committed Oct 6, 2017
1 parent a669fe0 commit d15e895
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/ChainedMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/ChainedSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d15e895

Please sign in to comment.