mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
remove patches
This commit is contained in:
parent
25d82a12d8
commit
8576954187
@ -1,5 +1,3 @@
|
||||
import "./patches"
|
||||
|
||||
import React from "react"
|
||||
import { Runtime } from "@ragestudio/vessel"
|
||||
import { Helmet } from "react-helmet"
|
||||
|
@ -1,53 +0,0 @@
|
||||
// Patch global prototypes
|
||||
import { Buffer } from "buffer"
|
||||
|
||||
globalThis.IS_MOBILE_HOST = window.navigator.userAgent === "capacitor"
|
||||
|
||||
window.Buffer = Buffer
|
||||
|
||||
Array.prototype.findAndUpdateObject = function (discriminator, obj) {
|
||||
let index = this.findIndex(item => item[discriminator] === obj[discriminator])
|
||||
if (index !== -1) {
|
||||
this[index] = obj
|
||||
}
|
||||
|
||||
return index
|
||||
}
|
||||
|
||||
Array.prototype.move = function (from, to) {
|
||||
this.splice(to, 0, this.splice(from, 1)[0])
|
||||
return this
|
||||
}
|
||||
|
||||
String.prototype.toTitleCase = function () {
|
||||
return this.replace(/\w\S*/g, function (txt) {
|
||||
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
|
||||
})
|
||||
}
|
||||
|
||||
String.prototype.toBoolean = function () {
|
||||
return this === "true"
|
||||
}
|
||||
|
||||
Promise.tasked = function (promises) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let rejected = false
|
||||
|
||||
for await (let promise of promises) {
|
||||
if (rejected) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await promise()
|
||||
} catch (error) {
|
||||
rejected = true
|
||||
return reject(error)
|
||||
}
|
||||
}
|
||||
|
||||
if (!rejected) {
|
||||
return resolve()
|
||||
}
|
||||
})
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user