ag-reactive
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -11,3 +11,3 @@ import { Wrapper } from "./Wrapper"; | ||
}; | ||
export declare function reactive<T>(raw: T): T; | ||
export declare function reactive<T>(raw: T, id?: string): T; | ||
export declare function observe(obj: any, cb: (delta: Delta) => void): { | ||
@@ -14,0 +14,0 @@ id: string; |
10
index.js
@@ -44,7 +44,11 @@ "use strict"; | ||
exports.isReactive = isReactive; | ||
function reactive(raw) { | ||
function reactive(raw, id) { | ||
var _a, _b; | ||
if (isRaw(raw) || isReactive(raw)) | ||
if (isRaw(raw) || isReactive(raw)) { | ||
if (id) { | ||
throw 'failed to create a new reactive object to hold the given id'; | ||
} | ||
return raw; | ||
var obj = new Wrapper_1.Wrapper(Array.isArray(raw)); | ||
} | ||
var obj = new Wrapper_1.Wrapper(Array.isArray(raw), id); | ||
for (var key in raw) { | ||
@@ -51,0 +55,0 @@ var value = ((_b = (_a = Object.getOwnPropertyDescriptor(raw, key)) === null || _a === void 0 ? void 0 : _a.get) !== null && _b !== void 0 ? _b : raw[key]); |
{ | ||
"name": "ag-reactive", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
40582
1151
1