Rocky_Mountain_Vending/.pnpm-store/v10/files/de/41b7b5c9e9e7d9a42a401a1043d8ac103691df8eea408b4897aadbd1e5eaa842209bba870492a6b8454846169252ca5355438afd72b4ca09ccb39664e99cc1
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

51 lines
No EOL
1.3 KiB
Text

"use strict";
/* ------------------------------------------------------------------------ */
module.exports = class SyncPromise {
constructor (fn) {
try {
fn (
x => { this.setValue (x, false) }, // resolve
x => { this.setValue (x, true) } // reject
)
} catch (e) {
this.setValue (e, true)
}
}
setValue (x, rejected) {
this.val = (x instanceof SyncPromise) ? x.val : x
this.rejected = rejected || ((x instanceof SyncPromise) ? x.rejected : false)
}
static valueFrom (x) {
if (x instanceof SyncPromise) {
if (x.rejected) throw x.val
else return x.val
} else {
return x
}
}
then (fn) {
try { if (!this.rejected) return SyncPromise.resolve (fn (this.val)) }
catch (e) { return SyncPromise.reject (e) }
return this
}
catch (fn) {
try { if (this.rejected) return SyncPromise.resolve (fn (this.val)) }
catch (e) { return SyncPromise.reject (e) }
return this
}
static resolve (x) {
return new SyncPromise (resolve => { resolve (x) })
}
static reject (x) {
return new SyncPromise ((_, reject) => { reject (x) })
}
}