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
| function reverseInPlace(arr) { | |
| let length = arr.length, | |
| middle = Math.floor(length / 2), | |
| temp = null | |
| for(let i = 0; i < middle; i++) { | |
| temp = arr[i] | |
| arr[i] = arr[arr.length - 1 - i] | |
| arr[arr.length - 1 - i] = temp | |
| } |
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
| function delay(ms) { | |
| return new Promise(resolve => { | |
| setTimeout(resolve, ms); | |
| }); | |
| } |
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
| export const lazy = (componentFactoryPromise) => { | |
| const componentPromise = componentFactoryPromise() | |
| let Component | |
| componentPromise.then(C => { | |
| Component = C.default | |
| }) | |
| return (props) => { | |
| if(!Component) { | |
| throw componentPromise |
OlderNewer