Rocky_Mountain_Vending/.pnpm-store/v10/files/d2/52ad03147d17d768d7431f275e8a94140f903dd75c7e43d9bb5350639dc4d1e2b1903d3fcf412e18af4b26ee07a99d9e4def983067d54a945f49ac4d51e8fe
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

53 lines
No EOL
1.8 KiB
Text

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.awaitEachYieldedPromise = exports.maybeAsync = exports.maybeAsyncFn = void 0;
function* awaitYield(value) {
return (yield value);
}
function awaitYieldOf(generator) {
return awaitYield(awaitEachYieldedPromise(generator));
}
const AwaitYield = awaitYield;
AwaitYield.of = awaitYieldOf;
/**
* Create a function that may or may not be async, using a generator
*
* Within the generator, call `yield* awaited(maybePromise)` to await a value
* that may or may not be a promise.
*
* If the inner function never yields a promise, it will return synchronously.
*/
function maybeAsyncFn(that, fn) {
return (...args) => {
const generator = fn.call(that, AwaitYield, ...args);
return awaitEachYieldedPromise(generator);
};
}
exports.maybeAsyncFn = maybeAsyncFn;
class Example {
constructor() {
this.maybeAsyncMethod = maybeAsyncFn(this, function* (awaited, a) {
yield* awaited(new Promise((resolve) => setTimeout(resolve, a)));
return 5;
});
}
}
function maybeAsync(that, startGenerator) {
const generator = startGenerator.call(that, AwaitYield);
return awaitEachYieldedPromise(generator);
}
exports.maybeAsync = maybeAsync;
function awaitEachYieldedPromise(gen) {
function handleNextStep(step) {
if (step.done) {
return step.value;
}
if (step.value instanceof Promise) {
return step.value.then((value) => handleNextStep(gen.next(value)), (error) => handleNextStep(gen.throw(error)));
}
return handleNextStep(gen.next(step.value));
}
return handleNextStep(gen.next());
}
exports.awaitEachYieldedPromise = awaitEachYieldedPromise;
//# sourceMappingURL=asyncify-helpers.js.map