mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-28 19:11:42 +00:00
Replace isPlainObject
This commit is contained in:
parent
4e75f8bf2f
commit
6411ee4e34
4 changed files with 33 additions and 24 deletions
44
package-lock.json
generated
44
package-lock.json
generated
|
@ -10,6 +10,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pixi/particle-emitter": "^5.0.4",
|
"@pixi/particle-emitter": "^5.0.4",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
|
"is-plain-object": "^5.0.0",
|
||||||
"jest-environment-jsdom": "^28.1.1",
|
"jest-environment-jsdom": "^28.1.1",
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
"lz-string": "^1.4.4",
|
"lz-string": "^1.4.4",
|
||||||
|
@ -6053,6 +6054,18 @@
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/clone-deep/node_modules/is-plain-object": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"isobject": "^3.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/co": {
|
"node_modules/co": {
|
||||||
"version": "4.6.0",
|
"version": "4.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
||||||
|
@ -9173,13 +9186,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/is-plain-object": {
|
"node_modules/is-plain-object": {
|
||||||
"version": "2.0.4",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
||||||
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
|
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"isobject": "^3.0.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
|
@ -21484,6 +21493,17 @@
|
||||||
"is-plain-object": "^2.0.4",
|
"is-plain-object": "^2.0.4",
|
||||||
"kind-of": "^6.0.2",
|
"kind-of": "^6.0.2",
|
||||||
"shallow-clone": "^3.0.0"
|
"shallow-clone": "^3.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"is-plain-object": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"isobject": "^3.0.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"co": {
|
"co": {
|
||||||
|
@ -23777,13 +23797,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"is-plain-object": {
|
"is-plain-object": {
|
||||||
"version": "2.0.4",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
||||||
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
|
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"isobject": "^3.0.1"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"is-potential-custom-element-name": {
|
"is-potential-custom-element-name": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pixi/particle-emitter": "^5.0.4",
|
"@pixi/particle-emitter": "^5.0.4",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
|
"is-plain-object": "^5.0.0",
|
||||||
"jest-environment-jsdom": "^28.1.1",
|
"jest-environment-jsdom": "^28.1.1",
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
"lz-string": "^1.4.4",
|
"lz-string": "^1.4.4",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Decimal from "util/bignum";
|
import Decimal from "util/bignum";
|
||||||
import { isPlainObject } from "util/common";
|
import { isPlainObject } from "is-plain-object";
|
||||||
import { ProxiedWithState, ProxyPath, ProxyState } from "util/proxies";
|
import { ProxiedWithState, ProxyPath, ProxyState } from "util/proxies";
|
||||||
import { reactive, unref } from "vue";
|
import { reactive, unref } from "vue";
|
||||||
import transientState from "./state";
|
import transientState from "./state";
|
||||||
|
@ -51,11 +51,7 @@ const playerHandler: ProxyHandler<Record<PropertyKey, any>> = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = target[ProxyState][key];
|
const value = target[ProxyState][key];
|
||||||
if (
|
if (key !== "value" && (isPlainObject(value) || Array.isArray(value))) {
|
||||||
key !== "value" &&
|
|
||||||
(isPlainObject(value) || Array.isArray(value)) &&
|
|
||||||
!(value instanceof Decimal)
|
|
||||||
) {
|
|
||||||
if (value !== target[key]?.[ProxyState]) {
|
if (value !== target[key]?.[ProxyState]) {
|
||||||
const path = [...target[ProxyPath], key];
|
const path = [...target[ProxyPath], key];
|
||||||
target[key] = new Proxy({ [ProxyState]: value, [ProxyPath]: path }, playerHandler);
|
target[key] = new Proxy({ [ProxyState]: value, [ProxyPath]: path }, playerHandler);
|
||||||
|
|
|
@ -8,10 +8,6 @@ export function camelToTitle(camel: string): string {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isPlainObject(object: unknown): boolean {
|
|
||||||
return Object.prototype.toString.call(object) === "[object Object]";
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
export function isFunction(func: unknown): func is Function {
|
export function isFunction(func: unknown): func is Function {
|
||||||
return typeof func === "function";
|
return typeof func === "function";
|
||||||
|
|
Loading…
Reference in a new issue