Skip to content

Commit ae7b9bb

Browse files
Merge pull request #126 from ca11ado/currying-partials
1-js/06-advanced-functions/11-currying-partials/article.md
2 parents 93ad43b + c72ecdc commit ae7b9bb

File tree

3 files changed

+95
-96
lines changed

3 files changed

+95
-96
lines changed

1-js/06-advanced-functions/11-currying-partials/1-ask-currying/solution.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

22

3-
1. Either use a wrapper function, an arrow to be concise:
3+
1. Либо для краткости используйте стрелочную функцию-обёртку:
44

55
```js
66
askPassword(() => user.login(true), () => user.login(false));
77
```
88

9-
Now it gets `user` from outer variables and runs it the normal way.
9+
Теперь `user` берётся из внешних переменных, и всё выполняется правильно.
1010

11-
2. Or create a partial function from `user.login` that uses `user` as the context and has the correct first argument:
11+
2. Либо сделайте из `user.login` функцию частичного применения, которая использует `user` как контекст, и которой передан корректный первый аргумент:
1212

1313

1414
```js

1-js/06-advanced-functions/11-currying-partials/1-ask-currying/task.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ importance: 5
22

33
---
44

5-
# Partial application for login
5+
# Частичное применение для логина
66

7-
The task is a little more complex variant of <info:task/question-use-bind>.
7+
Эта задача -- немного более усложнённый вариант <info:task/question-use-bind>.
88

9-
The `user` object was modified. Now instead of two functions `loginOk/loginFail`, it has a single function `user.login(true/false)`.
9+
Объект `user` был изменён. Теперь вместо двух функций `loginOk/loginFail`, у него одна функция: `user.login(true/false)`.
1010

11-
What to pass `askPassword` in the code below, so that it calls `user.login(true)` as `ok` and `user.login(false)` as `fail`?
11+
Что нужно передать функции `askPassword` в коде ниже, чтобы она вызывала `user.login(true)` как `ok` и `user.login(false)` как `fail`?
1212

1313
```js
1414
function askPassword(ok, fail) {
@@ -30,5 +30,5 @@ askPassword(?, ?); // ?
3030
*/!*
3131
```
3232
33-
Your changes should only modify the highlighted fragment.
33+
Вы можете изменять только подсвеченные фрагменты кода.
3434

0 commit comments

Comments
 (0)