BlobKat Posted on Aug 22, 2024 • Edited on Sep 23, 2025 Safe assignment (?=) alternative for promises Promise.prototype.safe = function(){ return this.then( res => [null, res], err => [err, null] ); } const [err, res] = await fetch("https://blobk.at/").safe() Enter fullscreen mode Exit fullscreen mode Top comments (0) Subscribe Submit Preview Dismiss Code of Conduct • Report abuse
Top comments (0)