From 6c9706625f7f896e2c2e1b4a64baadc6f9ccc604 Mon Sep 17 00:00:00 2001 From: Tlekbai Ali Date: Fri, 26 Jun 2020 11:42:18 +0600 Subject: [PATCH 1/3] Update README.md Add clarification --- subjects/keep-trying-or-giveup/README.md | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/subjects/keep-trying-or-giveup/README.md b/subjects/keep-trying-or-giveup/README.md index cb69cecc..867ff618 100644 --- a/subjects/keep-trying-or-giveup/README.md +++ b/subjects/keep-trying-or-giveup/README.md @@ -3,25 +3,23 @@ ### Instructions Create a `retry` function, that takes 2 arguments -- a `count`, that tells how many retries must be done -- an async `callback`, that will be call every try +- a `count` indicates maximum amount of retries +- an async `callback`, that will be called on every try -and it return a new function, passing arguments given to the -callback on every tries. +`retry` returns a function that calls and returns value from `callback` +function passing its arguments and catches errors. If number of errors +exceeds `count` then throw an `Error`. > for count of 3, the function will be called at most 4 times: > the initial call + 3 retries. - Create a `timeout` function, that takes 2 arguments -- a `delay`, that tells how long to wait -- an async `callback`, that will be call - -and it return a new function, passing arguments given to the callback -and either the async callback resolve before the delay is reached, -in that case we return the value from the callback, -or reject an error using the message `"timeout"` +- a `delay` indicates maximum wait time +- an async `callback`, that will be called +`timeout` returns a function either that calls and returns value from `callback` +function passing its arguments or returns `Error('timeout')` if `callback` didn't +resolve before `delay` time has reached. ### Notions From 6a16a08b3465ea6510bbec257dc05290bd517ae8 Mon Sep 17 00:00:00 2001 From: Tlekbai Ali Date: Fri, 26 Jun 2020 12:20:08 +0600 Subject: [PATCH 2/3] Update README.md --- subjects/keep-trying-or-giveup/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subjects/keep-trying-or-giveup/README.md b/subjects/keep-trying-or-giveup/README.md index 867ff618..a18dbcb3 100644 --- a/subjects/keep-trying-or-giveup/README.md +++ b/subjects/keep-trying-or-giveup/README.md @@ -7,7 +7,8 @@ Create a `retry` function, that takes 2 arguments - an async `callback`, that will be called on every try `retry` returns a function that calls and returns value from `callback` -function passing its arguments and catches errors. If number of errors +function passing its arguments and catches errors. If error is caught it +should return the `callback` function. If number of errors exceeds `count` then throw an `Error`. > for count of 3, the function will be called at most 4 times: From 6502bae4568f76e98b0217507bf19e0277999e0d Mon Sep 17 00:00:00 2001 From: Tlekbai Ali Date: Fri, 26 Jun 2020 12:23:53 +0600 Subject: [PATCH 3/3] Update README.md --- subjects/keep-trying-or-giveup/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subjects/keep-trying-or-giveup/README.md b/subjects/keep-trying-or-giveup/README.md index a18dbcb3..f90875d9 100644 --- a/subjects/keep-trying-or-giveup/README.md +++ b/subjects/keep-trying-or-giveup/README.md @@ -8,7 +8,7 @@ Create a `retry` function, that takes 2 arguments `retry` returns a function that calls and returns value from `callback` function passing its arguments and catches errors. If error is caught it -should return the `callback` function. If number of errors +should return the `callback` function with catch. If number of errors exceeds `count` then throw an `Error`. > for count of 3, the function will be called at most 4 times: