Comparing version 2.1.0 to 2.1.1
{ | ||
"name": "araz", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.ts", |
@@ -24,3 +24,2 @@ type Ref<T> = { | ||
target[key] = value; | ||
console.log("Value changed:", value); | ||
return true; | ||
@@ -39,8 +38,10 @@ } | ||
export const reactive = <T>(obj: T): ReactiveObject<T> => { | ||
export const reactive = <T extends Record<string, any>>( | ||
obj: T | ||
): ReactiveObject<T> => { | ||
const reactiveObject = {} as ReactiveObject<T>; | ||
for (const key in obj) { | ||
if (obj[key]) { | ||
reactiveObject[key] = ref(obj[key]); | ||
if (Object.prototype.hasOwnProperty.call(obj, key)) { | ||
reactiveObject[key as keyof T] = ref(obj[key]); | ||
} | ||
@@ -52,3 +53,3 @@ } | ||
if (key in target) { | ||
return target[key].value; | ||
return target[key as keyof T].value; | ||
} | ||
@@ -58,4 +59,3 @@ }, | ||
if (key in target) { | ||
target[key].value = value; | ||
console.log(`Value changed for ${String(key)}:`, value); | ||
target[key as keyof T].value = value; | ||
return true; | ||
@@ -62,0 +62,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16046