Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move 'allowSet' to the ItemConfig #20

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ const Item = class {
#data
#self

constructor(data, { allowSet = [], ...rest } = {}) {
constructor(data) {
if (Object.getPrototypeOf(this) === Item.prototype) {
throw new Error("'Item's cannot be created directly. You must create a sub-class and configure it via 'Item.bindCreationConfig'.")
}
Expand All @@ -191,7 +191,7 @@ const Item = class {
data : this.#data,
propIndex,
methodIndex,
allowSet
allowSet: this.allowSet
}))

// since we return the proxy, we save the real underlying object internally
Expand All @@ -202,6 +202,8 @@ const Item = class {

// get id() { return this.#data.id || this.#idNormalizer(this.#data[this.#keyField]) }

get allowSet() { return structuredClone(this.constructor.itemConfig.allowSet )}

get data() { return structuredClone(this.#data) }

get dataCleaned() {
Expand Down