@solid-primitives/immutable
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -32,7 +32,18 @@ import { createMemo, untrack, $PROXY, $TRACK, runWithOwner, getOwner, onCleanup, createRoot, getListener } from 'solid-js'; | ||
getOwnPropertyDescriptor(target, property) { | ||
return this.has(target, property) ? { | ||
enumerable: true, | ||
get: () => this.get(target, property, this), | ||
configurable: true | ||
} : void 0; | ||
let desc = Reflect.getOwnPropertyDescriptor(target, property); | ||
if (desc) { | ||
if (desc.get) { | ||
desc.get = this.get.bind(this, target, property, this); | ||
delete desc.writable; | ||
} else { | ||
desc.value = this.get(target, property, this); | ||
} | ||
} else { | ||
desc = this.has(target, property) ? { | ||
enumerable: true, | ||
configurable: true, | ||
get: this.get.bind(this, target, property, this) | ||
} : void 0; | ||
} | ||
return desc; | ||
} | ||
@@ -62,3 +73,4 @@ set = trueFn; | ||
return source ? source[property] : void 0; | ||
}, memo = false; | ||
}; | ||
let memo = false; | ||
this.#cache.set( | ||
@@ -119,3 +131,3 @@ property, | ||
return this.#trackLength(), this.s()[num]; | ||
return untrack(this.#trackItems)[num]?.get(); | ||
return untrack(this.#trackItems)[num].get(); | ||
} | ||
@@ -157,6 +169,3 @@ }; | ||
}; | ||
var wrap = (initialValue, source, config) => new Proxy( | ||
initialValue.constructor(), | ||
new (Array.isArray(initialValue) ? ArrayTraps : ObjectTraps)(source, config) | ||
); | ||
var wrap = (initialValue, source, config) => Array.isArray(initialValue) ? new Proxy([], new ArrayTraps(source, config)) : new Proxy({}, new ObjectTraps(source, config)); | ||
function createImmutable(source, options = {}) { | ||
@@ -163,0 +172,0 @@ const memo = createMemo(source); |
{ | ||
"name": "@solid-primitives/immutable", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Primitive for rectifying immutable values and dealing with immutability in Solid.", | ||
@@ -5,0 +5,0 @@ "author": "Damian Tarnawski <gthetarnav@gmail.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
28488
556