This commit is contained in:
nim-ka
2022-10-29 02:51:09 +00:00
parent 1c7aaa8fd5
commit e5ba84719d

View File

@@ -1,9 +1,22 @@
let warned = false
Object.defineProperty(Object.prototype, "copyDeep", {
Object.defineProperties(Object.prototype, {
copyDeep: {
value: function() {
return JSON.parse(JSON.stringify(this))
}
},
num: {
value: function() {
if (this.map) {
return this.map((e) => +e)
} else if (this.mapMut) {
return this.mapMut((e) => +e)
} else {
console.error("Object.prototype.num: No suitable map method found")
}
}
}
})
Object.defineProperties(Array.prototype, {