This commit is contained in:
nim-ka
2021-12-29 23:52:48 -05:00
parent 630f3a46a8
commit 4a95bf74b0
2 changed files with 8 additions and 4 deletions

6
out.js
View File

@@ -601,6 +601,8 @@ class Node {
}
}
let warned = false
Object.defineProperty(Object.prototype, "copyDeep", {
value: function() {
return JSON.parse(JSON.stringify(this))
@@ -686,9 +688,9 @@ Object.defineProperties(Array.prototype, {
},
pushUniq: {
value: function(...vals) {
if (!this.warned) {
if (!warned) {
console.warn("You should probably use a Set")
this.warned = true
warned = true
}
return this.push(...vals.uniq().sub(this))

View File

@@ -1,3 +1,5 @@
let warned = false
Object.defineProperty(Object.prototype, "copyDeep", {
value: function() {
return JSON.parse(JSON.stringify(this))
@@ -83,9 +85,9 @@ Object.defineProperties(Array.prototype, {
},
pushUniq: {
value: function(...vals) {
if (!this.warned) {
if (!warned) {
console.warn("You should probably use a Set")
this.warned = true
warned = true
}
return this.push(...vals.uniq().sub(this))