Skip to content

Commit

Permalink
Merge pull request javascript-tutorial#382 from brentguf/currying
Browse files Browse the repository at this point in the history
Currying/Partials chapter
  • Loading branch information
iliakan authored Mar 3, 2018
2 parents 9cae9d3 + 7bad527 commit 228873c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The task is a little more complex variant of <info:task/question-use-bind>.

The `user` object was modified. Now instead of two functions `loginOk/loginFail`, it has a single function `user.login(true/false)`.

What to pass `askPassword` in the code below, so that it calls `user.login(true)` as `ok` and `user.login(fail)` as `fail`?
What to pass `askPassword` in the code below, so that it calls `user.login(true)` as `ok` and `user.login(false)` as `fail`?

```js
function askPassword(ok, fail) {
Expand Down
4 changes: 2 additions & 2 deletions 1-js/06-advanced-functions/11-currying-partials/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ libs:

# Currying and partials

Till now we were only talking about binding `this`. Now let's make a step further.
Until now we have only been talking about binding `this`. Let's take it a step further.

We can bind not only `this`, but also arguments. That's rarely done, but sometimes can be handy.

Expand Down Expand Up @@ -146,7 +146,7 @@ More advanced implementations of currying like [_.curry](https://lodash.com/docs

```js
function curry(f) {
return function(..args) {
return function(...args) {
// if args.length == f.length (as many arguments as f has),
// then pass the call to f
// otherwise return a partial function that fixes args as first arguments
Expand Down

0 comments on commit 228873c

Please sign in to comment.