This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const controller = new AbortController(); | |
type RetryOptions = { | |
fetchOptons: RequestInit; | |
delayMs: number; | |
timeOutMs: number; | |
retries: number; | |
}; | |
const fetchWithRetry = async (url: string, retryOptions: RetryOptions) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getErrorDetails = (err: any) => { | |
if (!err) return 'Unknown error'; | |
const messages: string[] = []; | |
// Error name | |
if (err.name) messages.push(`Name: ${err.name}`); | |
//Native errors | |
if (err.message) messages.push(err.message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
We should find a code to draw a pine tree. | |
like the o ne below | |
* | |
*** | |
***** | |
******* | |
||| | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const basicFibonacci =(n)=> { | |
//console.log('bassic fibonacci'); | |
if(n<2) return n | |
return basicFibonacci(n-1)+ basicFibonacci(n-1); | |
}; | |
module.exports = basicFibonacci; |