.
This commit is contained in:
15
proto.js
15
proto.js
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user