deep6 1.1.4 → 1.2.0
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.
- package/LICENSE +1 -1
- package/README.md +40 -39
- package/llms-full.txt +371 -0
- package/llms.txt +154 -0
- package/package.json +31 -109
- package/src/env.d.ts +174 -0
- package/src/env.js +4 -4
- package/src/index.d.ts +86 -0
- package/src/index.js +10 -7
- package/src/traverse/assemble.d.ts +59 -0
- package/src/traverse/assemble.js +4 -3
- package/src/traverse/clone.d.ts +57 -0
- package/src/traverse/clone.js +4 -2
- package/src/traverse/deref.d.ts +59 -0
- package/src/traverse/deref.js +3 -2
- package/src/traverse/preprocess.d.ts +65 -0
- package/src/traverse/preprocess.js +2 -1
- package/src/traverse/walk.d.ts +219 -0
- package/src/traverse/walk.js +9 -4
- package/src/unifiers/matchCondition.d.ts +45 -0
- package/src/unifiers/matchCondition.js +1 -0
- package/src/unifiers/matchInstanceOf.d.ts +37 -0
- package/src/unifiers/matchInstanceOf.js +1 -0
- package/src/unifiers/matchString.d.ts +56 -0
- package/src/unifiers/matchString.js +1 -0
- package/src/unifiers/matchTypeOf.d.ts +37 -0
- package/src/unifiers/matchTypeOf.js +1 -0
- package/src/unifiers/ref.d.ts +52 -0
- package/src/unifiers/ref.js +1 -0
- package/src/unify.d.ts +95 -0
- package/src/unify.js +130 -66
- package/src/utils/replaceVars.d.ts +25 -0
- package/src/utils/replaceVars.js +23 -19
- package/cjs/env.js +0 -183
- package/cjs/index.js +0 -44
- package/cjs/package.json +0 -1
- package/cjs/traverse/assemble.js +0 -129
- package/cjs/traverse/clone.js +0 -82
- package/cjs/traverse/deref.js +0 -87
- package/cjs/traverse/preprocess.js +0 -84
- package/cjs/traverse/walk.js +0 -263
- package/cjs/unifiers/matchCondition.js +0 -18
- package/cjs/unifiers/matchInstanceOf.js +0 -18
- package/cjs/unifiers/matchString.js +0 -38
- package/cjs/unifiers/matchTypeOf.js +0 -18
- package/cjs/unifiers/ref.js +0 -23
- package/cjs/unify.js +0 -473
- package/cjs/utils/replaceVars.js +0 -28
package/cjs/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "_", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _env._;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "any", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _env.any;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
exports.match = exports.isShape = exports.equal = exports.default = exports.clone = void 0;
|
|
19
|
-
var _env = require("./env.js");
|
|
20
|
-
var _unify = _interopRequireDefault(require("./unify.js"));
|
|
21
|
-
var _clone = _interopRequireDefault(require("./traverse/clone.js"));
|
|
22
|
-
var _preprocess = _interopRequireDefault(require("./traverse/preprocess.js"));
|
|
23
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
-
const defaultOptions = {
|
|
25
|
-
circular: true
|
|
26
|
-
};
|
|
27
|
-
const equal = (a, b, options = defaultOptions) => !!(0, _unify.default)(a, b, null, options);
|
|
28
|
-
exports.equal = equal;
|
|
29
|
-
const defaultMatchOptions = {
|
|
30
|
-
openObjects: true,
|
|
31
|
-
openMaps: true,
|
|
32
|
-
openSets: true,
|
|
33
|
-
circular: true
|
|
34
|
-
};
|
|
35
|
-
const match = (object, pattern, options = defaultMatchOptions) => !!(0, _unify.default)(object, (0, _preprocess.default)(pattern, options), null, {
|
|
36
|
-
circular: options.circular,
|
|
37
|
-
symbols: options.symbols,
|
|
38
|
-
loose: options.loose,
|
|
39
|
-
ignoreFunctions: options.ignoreFunctions
|
|
40
|
-
});
|
|
41
|
-
exports.isShape = exports.match = match;
|
|
42
|
-
const clone = (a, options = defaultOptions) => (0, _clone.default)(a, null, options);
|
|
43
|
-
exports.clone = clone;
|
|
44
|
-
var _default = exports.default = equal;
|
package/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|
package/cjs/traverse/assemble.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.registry = exports.filters = exports.default = void 0;
|
|
7
|
-
var _unify = require("../unify.js");
|
|
8
|
-
var _walk = _interopRequireWildcard(require("./walk.js"));
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
const empty = {};
|
|
12
|
-
function postProcess(context) {
|
|
13
|
-
const stackOut = context.stackOut,
|
|
14
|
-
s = this.s,
|
|
15
|
-
{
|
|
16
|
-
descriptors,
|
|
17
|
-
keys
|
|
18
|
-
} = (0, _walk.getObjectData)(s, context);
|
|
19
|
-
let j = stackOut.length - 1;
|
|
20
|
-
const result = keys.some(k => {
|
|
21
|
-
const d = descriptors[k];
|
|
22
|
-
if (d.get || d.set) return false;
|
|
23
|
-
const t = stackOut[j--];
|
|
24
|
-
return typeof t == 'number' && isNaN(t) ? typeof s[k] == 'number' && !isNaN(s[k]) : s[k] !== t;
|
|
25
|
-
});
|
|
26
|
-
if (result) {
|
|
27
|
-
(0, _walk.buildNewObject)(s, descriptors, keys, stackOut);
|
|
28
|
-
} else {
|
|
29
|
-
(0, _walk.replaceObject)(j, s, stackOut);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function postProcessSeen(context) {
|
|
33
|
-
const stackOut = context.stackOut,
|
|
34
|
-
s = this.s,
|
|
35
|
-
{
|
|
36
|
-
descriptors,
|
|
37
|
-
keys
|
|
38
|
-
} = (0, _walk.getObjectData)(s, context);
|
|
39
|
-
let j = stackOut.length - 1;
|
|
40
|
-
const result = keys.some(k => {
|
|
41
|
-
const d = descriptors[k];
|
|
42
|
-
if (d.get || d.set) return false;
|
|
43
|
-
const t = stackOut[j--];
|
|
44
|
-
return typeof t == 'number' && isNaN(t) ? typeof s[k] == 'number' && !isNaN(s[k]) : s[k] !== t;
|
|
45
|
-
});
|
|
46
|
-
if (result) {
|
|
47
|
-
(0, _walk.postObjectCircular)(s, descriptors, keys, context);
|
|
48
|
-
} else {
|
|
49
|
-
(0, _walk.replaceObject)(j, s, stackOut);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const postProcessMap = context => {
|
|
53
|
-
const stackOut = context.stackOut,
|
|
54
|
-
s = (void 0).s;
|
|
55
|
-
let j = stackOut.length - 1;
|
|
56
|
-
const result = Array.from(s.values()).some(v => {
|
|
57
|
-
const t = stackOut[j--];
|
|
58
|
-
return typeof t == 'number' && isNaN(t) ? typeof v == 'number' && !isNaN(v) : v !== t;
|
|
59
|
-
});
|
|
60
|
-
if (result) {
|
|
61
|
-
(0, _walk.buildNewMap)(s.keys(), stackOut);
|
|
62
|
-
} else {
|
|
63
|
-
(0, _walk.replaceObject)(j, s, stackOut);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
function postProcessMapSeen(context) {
|
|
67
|
-
const stackOut = context.stackOut,
|
|
68
|
-
s = this.s;
|
|
69
|
-
let j = stackOut.length - 1;
|
|
70
|
-
const result = Array.from(s.values()).some(v => {
|
|
71
|
-
const t = stackOut[j--];
|
|
72
|
-
return typeof t == 'number' && isNaN(t) ? typeof v == 'number' && !isNaN(v) : v !== t;
|
|
73
|
-
});
|
|
74
|
-
if (result) {
|
|
75
|
-
(0, _walk.postMapCircular)(s, context);
|
|
76
|
-
} else {
|
|
77
|
-
(0, _walk.replaceObject)(j, s, stackOut);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
const registry = exports.registry = [_walk.default.Command, _walk.processCommand, Array, (0, _walk.processObject)(postProcess, postProcessSeen), _unify.Variable, _walk.processVariable, _unify.Unifier, _walk.processOther, Date, _walk.processOther, RegExp, _walk.processOther, Map, (0, _walk.processMap)(postProcessMap, postProcessMapSeen), Set, _walk.processOther, Promise, _walk.processOther],
|
|
81
|
-
filters = exports.filters = [];
|
|
82
|
-
|
|
83
|
-
// add more types
|
|
84
|
-
|
|
85
|
-
const addType = (Type, process) => registry.push(Type, process || _walk.processOther);
|
|
86
|
-
typeof Int8Array == 'function' && addType(Int8Array);
|
|
87
|
-
typeof Uint8Array == 'function' && addType(Uint8Array);
|
|
88
|
-
typeof Uint8ClampedArray == 'function' && addType(Uint8ClampedArray);
|
|
89
|
-
typeof Int16Array == 'function' && addType(Int16Array);
|
|
90
|
-
typeof Uint16Array == 'function' && addType(Uint16Array);
|
|
91
|
-
typeof Int32Array == 'function' && addType(Int32Array);
|
|
92
|
-
typeof Uint32Array == 'function' && addType(Uint32Array);
|
|
93
|
-
typeof Float32Array == 'function' && addType(Float32Array);
|
|
94
|
-
typeof Float64Array == 'function' && addType(Float64Array);
|
|
95
|
-
typeof BigInt64Array == 'function' && addType(BigInt64Array);
|
|
96
|
-
typeof BigUint64Array == 'function' && addType(BigUint64Array);
|
|
97
|
-
typeof DataView == 'function' && addType(DataView);
|
|
98
|
-
typeof ArrayBuffer == 'function' && addType(ArrayBuffer);
|
|
99
|
-
|
|
100
|
-
// main
|
|
101
|
-
|
|
102
|
-
const assemble = (source, env, options) => {
|
|
103
|
-
if (env && !(env instanceof _unify.Env)) {
|
|
104
|
-
options = env;
|
|
105
|
-
env = null;
|
|
106
|
-
}
|
|
107
|
-
options = options || empty;
|
|
108
|
-
const context = options.context || {},
|
|
109
|
-
stackOut = [];
|
|
110
|
-
context.stackOut = stackOut;
|
|
111
|
-
context.env = env;
|
|
112
|
-
(0, _walk.default)(source, {
|
|
113
|
-
processObject: options.processObject || (0, _walk.processObject)(postProcess, postProcessSeen),
|
|
114
|
-
processOther: options.processOther || _walk.processOther,
|
|
115
|
-
processCircular: options.processCircular || _walk.processCircular,
|
|
116
|
-
registry: options.registry || assemble.registry,
|
|
117
|
-
filters: options.filters || assemble.filters,
|
|
118
|
-
circular: options.circular,
|
|
119
|
-
symbols: options.symbols,
|
|
120
|
-
allProps: options.allProps,
|
|
121
|
-
context: context
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// ice.assert(stackOut.length == 1);
|
|
125
|
-
return stackOut[0];
|
|
126
|
-
};
|
|
127
|
-
assemble.registry = registry;
|
|
128
|
-
assemble.filters = filters;
|
|
129
|
-
var _default = exports.default = assemble;
|
package/cjs/traverse/clone.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.registry = exports.filters = exports.default = void 0;
|
|
7
|
-
var _unify = require("../unify.js");
|
|
8
|
-
var _walk = _interopRequireWildcard(require("./walk.js"));
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
const empty = {};
|
|
12
|
-
function postProcess(context) {
|
|
13
|
-
const {
|
|
14
|
-
descriptors,
|
|
15
|
-
keys
|
|
16
|
-
} = (0, _walk.getObjectData)(this.s, context);
|
|
17
|
-
(0, _walk.buildNewObject)(this.s, descriptors, keys, context.stackOut);
|
|
18
|
-
}
|
|
19
|
-
function postProcessSeen(context) {
|
|
20
|
-
const {
|
|
21
|
-
descriptors,
|
|
22
|
-
keys
|
|
23
|
-
} = (0, _walk.getObjectData)(this.s, context);
|
|
24
|
-
(0, _walk.postObjectCircular)(this.s, descriptors, keys, context);
|
|
25
|
-
}
|
|
26
|
-
function postProcessMap(context) {
|
|
27
|
-
(0, _walk.buildNewMap)(this.s.keys(), context.stackOut);
|
|
28
|
-
}
|
|
29
|
-
function postProcessMapSeen(context) {
|
|
30
|
-
(0, _walk.postMapCircular)(this.s, context);
|
|
31
|
-
}
|
|
32
|
-
const registry = exports.registry = [_walk.default.Command, _walk.processCommand, Array, (0, _walk.processObject)(postProcess, postProcessSeen), _unify.Variable, _walk.processVariable, _unify.Unifier, _walk.processOther, Date, (val, context) => context.stackOut.push(new Date(val.getTime())), RegExp, (val, context) => context.stackOut.push(new RegExp(val.source, (val.global ? 'g' : '') + (val.multiline ? 'm' : '') + (val.ignoreCase ? 'i' : ''))), Map, (0, _walk.processMap)(postProcessMap, postProcessMapSeen), Promise, _walk.processOther],
|
|
33
|
-
filters = exports.filters = [];
|
|
34
|
-
|
|
35
|
-
// add more types
|
|
36
|
-
|
|
37
|
-
const addType = (Type, process) => registry.push(Type, process || ((val, context) => context.stackOut.push(new Type(val))));
|
|
38
|
-
addType(Set);
|
|
39
|
-
typeof Int8Array == 'function' && addType(Int8Array);
|
|
40
|
-
typeof Uint8Array == 'function' && addType(Uint8Array);
|
|
41
|
-
typeof Uint8ClampedArray == 'function' && addType(Uint8ClampedArray);
|
|
42
|
-
typeof Int16Array == 'function' && addType(Int16Array);
|
|
43
|
-
typeof Uint16Array == 'function' && addType(Uint16Array);
|
|
44
|
-
typeof Int32Array == 'function' && addType(Int32Array);
|
|
45
|
-
typeof Uint32Array == 'function' && addType(Uint32Array);
|
|
46
|
-
typeof Float32Array == 'function' && addType(Float32Array);
|
|
47
|
-
typeof Float64Array == 'function' && addType(Float64Array);
|
|
48
|
-
typeof BigInt64Array == 'function' && addType(BigInt64Array);
|
|
49
|
-
typeof BigUint64Array == 'function' && addType(BigUint64Array);
|
|
50
|
-
typeof DataView == 'function' && addType(DataView);
|
|
51
|
-
typeof ArrayBuffer == 'function' && addType(ArrayBuffer);
|
|
52
|
-
|
|
53
|
-
// main
|
|
54
|
-
|
|
55
|
-
const clone = (source, env, options) => {
|
|
56
|
-
if (env && !(env instanceof _unify.Env)) {
|
|
57
|
-
options = env;
|
|
58
|
-
env = null;
|
|
59
|
-
}
|
|
60
|
-
options = options || empty;
|
|
61
|
-
const context = options.context || {},
|
|
62
|
-
stackOut = [];
|
|
63
|
-
context.stackOut = stackOut;
|
|
64
|
-
context.env = env;
|
|
65
|
-
(0, _walk.default)(source, {
|
|
66
|
-
processObject: options.processObject || (0, _walk.processObject)(postProcess, postProcessSeen),
|
|
67
|
-
processOther: options.processOther || _walk.processOther,
|
|
68
|
-
processCircular: options.processCircular || _walk.processCircular,
|
|
69
|
-
registry: options.registry || clone.registry,
|
|
70
|
-
filters: options.filters || clone.filters,
|
|
71
|
-
circular: options.circular,
|
|
72
|
-
symbols: options.symbols,
|
|
73
|
-
allProps: options.allProps,
|
|
74
|
-
context: context
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// ice.assert(stackOut.length == 1);
|
|
78
|
-
return stackOut[0];
|
|
79
|
-
};
|
|
80
|
-
clone.registry = registry;
|
|
81
|
-
clone.filters = filters;
|
|
82
|
-
var _default = exports.default = clone;
|
package/cjs/traverse/deref.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.registry = exports.filters = exports.default = void 0;
|
|
7
|
-
var _unify = require("../unify.js");
|
|
8
|
-
var _walk = _interopRequireWildcard(require("./walk.js"));
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
const empty = {};
|
|
12
|
-
function postProcess(context) {
|
|
13
|
-
const stackOut = context.stackOut,
|
|
14
|
-
s = this.s,
|
|
15
|
-
{
|
|
16
|
-
descriptors,
|
|
17
|
-
keys
|
|
18
|
-
} = (0, _walk.getObjectData)(s, context);
|
|
19
|
-
let j = stackOut.length - 1;
|
|
20
|
-
for (const key of keys) {
|
|
21
|
-
const d = descriptors[key];
|
|
22
|
-
if (!(d.get || d.set)) {
|
|
23
|
-
d.value = stackOut[j--];
|
|
24
|
-
Object.defineProperty(s, key, d);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
(0, _walk.replaceObject)(j, s, stackOut);
|
|
28
|
-
}
|
|
29
|
-
function postProcessMap(context) {
|
|
30
|
-
const stackOut = context.stackOut,
|
|
31
|
-
s = this.s;
|
|
32
|
-
let j = stackOut.length - 1;
|
|
33
|
-
for (const key of s) {
|
|
34
|
-
s.set(key, stackOut[j--]);
|
|
35
|
-
}
|
|
36
|
-
(0, _walk.replaceObject)(j, s, stackOut);
|
|
37
|
-
}
|
|
38
|
-
const registry = exports.registry = [_walk.default.Command, _walk.processCommand, Array, (0, _walk.processObject)(postProcess), _unify.Variable, _walk.processVariable, _unify.Unifier, _walk.processOther, Date, _walk.processOther, RegExp, _walk.processOther, Map, (0, _walk.processMap)(postProcessMap), Set, _walk.processOther, Promise, _walk.processOther],
|
|
39
|
-
filters = exports.filters = [];
|
|
40
|
-
|
|
41
|
-
// add more types
|
|
42
|
-
|
|
43
|
-
const addType = (Type, process) => registry.push(Type, process || _walk.processOther);
|
|
44
|
-
typeof Int8Array == 'function' && addType(Int8Array);
|
|
45
|
-
typeof Uint8Array == 'function' && addType(Uint8Array);
|
|
46
|
-
typeof Uint8ClampedArray == 'function' && addType(Uint8ClampedArray);
|
|
47
|
-
typeof Int16Array == 'function' && addType(Int16Array);
|
|
48
|
-
typeof Uint16Array == 'function' && addType(Uint16Array);
|
|
49
|
-
typeof Int32Array == 'function' && addType(Int32Array);
|
|
50
|
-
typeof Uint32Array == 'function' && addType(Uint32Array);
|
|
51
|
-
typeof Float32Array == 'function' && addType(Float32Array);
|
|
52
|
-
typeof Float64Array == 'function' && addType(Float64Array);
|
|
53
|
-
typeof BigInt64Array == 'function' && addType(BigInt64Array);
|
|
54
|
-
typeof BigUint64Array == 'function' && addType(BigUint64Array);
|
|
55
|
-
typeof DataView == 'function' && addType(DataView);
|
|
56
|
-
typeof ArrayBuffer == 'function' && addType(ArrayBuffer);
|
|
57
|
-
|
|
58
|
-
// main
|
|
59
|
-
|
|
60
|
-
const deref = (source, env, options) => {
|
|
61
|
-
if (env && !(env instanceof _unify.Env)) {
|
|
62
|
-
options = env;
|
|
63
|
-
env = null;
|
|
64
|
-
}
|
|
65
|
-
options = options || empty;
|
|
66
|
-
const context = options.context || {},
|
|
67
|
-
stackOut = [];
|
|
68
|
-
context.stackOut = stackOut;
|
|
69
|
-
context.env = env;
|
|
70
|
-
(0, _walk.default)(source, {
|
|
71
|
-
processObject: options.processObject || (0, _walk.processObject)(postProcess),
|
|
72
|
-
processOther: options.processOther || _walk.processOther,
|
|
73
|
-
processCircular: options.processCircular || _walk.processOther,
|
|
74
|
-
registry: options.registry || deref.registry,
|
|
75
|
-
filters: options.filters || deref.filters,
|
|
76
|
-
circular: options.circular,
|
|
77
|
-
symbols: options.symbols,
|
|
78
|
-
allProps: options.allProps,
|
|
79
|
-
context: context
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// ice.assert(stackOut.length == 1);
|
|
83
|
-
return stackOut[0];
|
|
84
|
-
};
|
|
85
|
-
deref.registry = registry;
|
|
86
|
-
deref.filters = filters;
|
|
87
|
-
var _default = exports.default = deref;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.registry = exports.filters = exports.default = void 0;
|
|
7
|
-
var _unify = require("../unify.js");
|
|
8
|
-
var _walk = _interopRequireWildcard(require("./walk.js"));
|
|
9
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
-
const empty = {};
|
|
12
|
-
function postProcess(context) {
|
|
13
|
-
const {
|
|
14
|
-
descriptors,
|
|
15
|
-
keys
|
|
16
|
-
} = (0, _walk.getObjectData)(this.s, context);
|
|
17
|
-
(0, _walk.buildNewObject)(this.s, descriptors, keys, context.stackOut, context[Array.isArray(this.s) ? 'wrapArray' : 'wrapObject']);
|
|
18
|
-
}
|
|
19
|
-
function postProcessSeen(context) {
|
|
20
|
-
const {
|
|
21
|
-
descriptors,
|
|
22
|
-
keys
|
|
23
|
-
} = (0, _walk.getObjectData)(this.s, context);
|
|
24
|
-
(0, _walk.postObjectCircular)(this.s, descriptors, keys, context);
|
|
25
|
-
}
|
|
26
|
-
function postProcessMap(context) {
|
|
27
|
-
(0, _walk.buildNewMap)(this.s.keys(), context.stackOut, context.wrapMap);
|
|
28
|
-
}
|
|
29
|
-
function postProcessMapSeen(context) {
|
|
30
|
-
(0, _walk.postMapCircular)(this.s, context);
|
|
31
|
-
}
|
|
32
|
-
function processSet(val, context) {
|
|
33
|
-
const wrap = context.wrapSet;
|
|
34
|
-
context.stackOut.push(wrap ? wrap(new Set(val)) : val);
|
|
35
|
-
}
|
|
36
|
-
const registry = exports.registry = [_walk.default.Command, _walk.processCommand, Array, (0, _walk.processObject)(postProcess, postProcessSeen), _unify.Variable, _walk.processOther, _unify.Unifier, _walk.processOther, Date, _walk.processOther, RegExp, _walk.processOther, Map, (0, _walk.processMap)(postProcessMap, postProcessMapSeen), Set, processSet, Promise, _walk.processOther],
|
|
37
|
-
filters = exports.filters = [];
|
|
38
|
-
|
|
39
|
-
// add more types
|
|
40
|
-
|
|
41
|
-
const addType = (Type, process) => registry.push(Type, process || _walk.processOther);
|
|
42
|
-
typeof Int8Array == 'function' && addType(Int8Array);
|
|
43
|
-
typeof Uint8Array == 'function' && addType(Uint8Array);
|
|
44
|
-
typeof Uint8ClampedArray == 'function' && addType(Uint8ClampedArray);
|
|
45
|
-
typeof Int16Array == 'function' && addType(Int16Array);
|
|
46
|
-
typeof Uint16Array == 'function' && addType(Uint16Array);
|
|
47
|
-
typeof Int32Array == 'function' && addType(Int32Array);
|
|
48
|
-
typeof Uint32Array == 'function' && addType(Uint32Array);
|
|
49
|
-
typeof Float32Array == 'function' && addType(Float32Array);
|
|
50
|
-
typeof Float64Array == 'function' && addType(Float64Array);
|
|
51
|
-
typeof BigInt64Array == 'function' && addType(BigInt64Array);
|
|
52
|
-
typeof BigUint64Array == 'function' && addType(BigUint64Array);
|
|
53
|
-
typeof DataView == 'function' && addType(DataView);
|
|
54
|
-
typeof ArrayBuffer == 'function' && addType(ArrayBuffer);
|
|
55
|
-
|
|
56
|
-
// main
|
|
57
|
-
|
|
58
|
-
const preprocess = (source, options) => {
|
|
59
|
-
options = options || empty;
|
|
60
|
-
const context = options.context || {},
|
|
61
|
-
stackOut = [];
|
|
62
|
-
context.stackOut = stackOut;
|
|
63
|
-
context.wrapObject = options.openObjects && _unify.open;
|
|
64
|
-
context.wrapArray = options.openArrays && _unify.open;
|
|
65
|
-
context.wrapMap = options.openMaps && _unify.open;
|
|
66
|
-
context.wrapSet = options.openSets && _unify.open;
|
|
67
|
-
(0, _walk.default)(source, {
|
|
68
|
-
processObject: options.processObject || (0, _walk.processObject)(postProcess, postProcessSeen),
|
|
69
|
-
processOther: options.processOther || _walk.processOther,
|
|
70
|
-
processCircular: options.processCircular || _walk.processCircular,
|
|
71
|
-
registry: options.registry || preprocess.registry,
|
|
72
|
-
filters: options.filters || preprocess.filters,
|
|
73
|
-
circular: options.circular,
|
|
74
|
-
symbols: options.symbols,
|
|
75
|
-
allProps: options.allProps,
|
|
76
|
-
context: context
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// ice.assert(stackOut.length == 1);
|
|
80
|
-
return stackOut[0];
|
|
81
|
-
};
|
|
82
|
-
preprocess.registry = registry;
|
|
83
|
-
preprocess.filters = filters;
|
|
84
|
-
var _default = exports.default = preprocess;
|