Moving node and pins information to Configuration

This commit is contained in:
barsdeveloper
2023-01-06 18:23:56 +01:00
parent af44de4539
commit a3e0d6be2b
29 changed files with 1548 additions and 1100 deletions

View File

@@ -19,6 +19,7 @@ import Utility from "../Utility"
* nullable?: Boolean,
* ignored?: Boolean,
* serialized?: Boolean,
* expected?: Boolean,
* predicate?: (value: AnyValue) => Boolean,
* }} AttributeInformation
*/
@@ -38,6 +39,7 @@ export default class IEntity {
nullable: false,
ignored: false,
serialized: false,
expected: false,
}
constructor(values = {}, suppressWarns = false) {
@@ -222,6 +224,12 @@ export default class IEntity {
return value != null && (value instanceof type || value.constructor === type)
}
static expectsAllKeys() {
return !Object.values(this.attributes)
.filter(/** @param {AttributeInformation} attribute */attribute => !attribute.ignored)
.some(/** @param {AttributeInformation} attribute */attribute => !attribute.expected)
}
unexpectedKeys() {
return Object.keys(this).length
- Object.keys(/** @type {typeof IEntity} */(this.constructor).attributes).length