Created
October 1, 2021 04:39
-
-
Save elzup/80dfe7bff7b39cb12c34d2c8343bf8ea to your computer and use it in GitHub Desktop.
This file contains 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
import { promisify } from 'util' | |
const sleep = (ms: number) => new Promise(r => setTimeout(r, ms)) | |
const argSwap = <A1, A2, R>(f: (a1: A1, a2: A2) => R) => (a2: A2, a1: A1) => | |
f(a1, a2) | |
const sleep2 = promisify((ms, cb) => setTimeout(cb, ms)) | |
const sleep3 = promisify(argSwap(setTimeout)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment