@fakenickels/let-anything
Advanced tools
Comparing version
{ | ||
"name": "@fakenickels/let-anything", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"main": "src/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -22,17 +22,15 @@ <p align="center"> | ||
```js | ||
import {letAnything} from '@fakenickels/let-anything'; | ||
import { letAnything } from "@fakenickels/let-anything"; | ||
// define a context, in this case we are creating our own async-await! | ||
const letPromise = letAnything({ | ||
let_: (value, continuation) => value.then(continuation), | ||
const letPromise = letAnything<Promise<any>>({ | ||
let_: (value, continuation) => value.then(continuation) | ||
}); | ||
async function main() { | ||
const userName = yield Promise.resolve("Subaru-kun") | ||
const deathCount = yield Promise.resolve(12909238409382) | ||
letPromise(function* () { | ||
const userName = yield Promise.resolve("Subaru-kun"); | ||
const deathCount = yield Promise.resolve(12909238409382); | ||
return Promise.resolve(`User ${userName} has a death count of ${deathCount}`) | ||
} | ||
letPromise(main).then(console.log).catch(console.log) | ||
return Promise.resolve(`User ${userName} has a death count of ${deathCount}`); | ||
}).then(console.log).catch(console.log) | ||
// User Subaru-kun has a death count of 12909238409382 | ||
@@ -39,0 +37,0 @@ ``` |
20222
0.01%249
-0.8%