@win2win/shared 1.0.126 → 1.0.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,4 +4,6 @@ export interface DeserializeOptions {
|
|
|
4
4
|
useInvisibleContext?: boolean;
|
|
5
5
|
}
|
|
6
6
|
export declare function deserialize(stringFn?: string, options?: DeserializeOptions): any;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function deserializeAndRun(stringFn?: string): any;
|
|
8
|
+
export declare function deserializeWithContext(stringFn?: string, context?: Record<string, any>): any;
|
|
9
|
+
export declare function deserializeWithContextAndRun(stringFn?: string, context?: Record<string, any>): any;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deserialize = deserialize;
|
|
4
|
+
exports.deserializeAndRun = deserializeAndRun;
|
|
4
5
|
exports.deserializeWithContext = deserializeWithContext;
|
|
6
|
+
exports.deserializeWithContextAndRun = deserializeWithContextAndRun;
|
|
5
7
|
function deserialize(stringFn, options) {
|
|
6
8
|
const { context = {}, run = false, useInvisibleContext = false, } = options || {};
|
|
7
9
|
if (!stringFn || typeof stringFn !== "string")
|
|
@@ -17,6 +19,20 @@ function deserialize(stringFn, options) {
|
|
|
17
19
|
return run ? null : () => null;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
|
-
function
|
|
21
|
-
return deserialize(stringFn, {
|
|
22
|
+
function deserializeAndRun(stringFn) {
|
|
23
|
+
return deserialize(stringFn, { run: true });
|
|
24
|
+
}
|
|
25
|
+
function deserializeWithContext(stringFn, context = {}) {
|
|
26
|
+
return deserialize(stringFn, {
|
|
27
|
+
context,
|
|
28
|
+
useInvisibleContext: true,
|
|
29
|
+
run: false,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function deserializeWithContextAndRun(stringFn, context = {}) {
|
|
33
|
+
return deserialize(stringFn, {
|
|
34
|
+
context,
|
|
35
|
+
useInvisibleContext: true,
|
|
36
|
+
run: true,
|
|
37
|
+
});
|
|
22
38
|
}
|
package/package.json
CHANGED