tape-six 0.9.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 +11 -0
- package/README.md +9 -0
- package/bin/tape6-server.js +196 -0
- package/bin/tape6.js +187 -0
- package/index.js +74 -0
- package/package.json +57 -0
- package/src/State.js +93 -0
- package/src/TTYReporter.js +270 -0
- package/src/TapReporter.js +126 -0
- package/src/Tester.js +411 -0
- package/src/deep6/env.js +174 -0
- package/src/deep6/index.js +21 -0
- package/src/deep6/traverse/assemble.js +158 -0
- package/src/deep6/traverse/clone.js +109 -0
- package/src/deep6/traverse/deref.js +104 -0
- package/src/deep6/traverse/preprocess.js +112 -0
- package/src/deep6/traverse/walk.js +262 -0
- package/src/deep6/unifiers/matchCondition.js +16 -0
- package/src/deep6/unifiers/matchInstanceOf.js +16 -0
- package/src/deep6/unifiers/matchString.js +33 -0
- package/src/deep6/unifiers/matchTypeOf.js +16 -0
- package/src/deep6/unifiers/ref.js +21 -0
- package/src/deep6/unify.js +446 -0
- package/src/deep6/utils/replaceVars.js +24 -0
- package/src/node/TestWorker.js +37 -0
- package/src/node/config.js +56 -0
- package/src/node/listing.js +78 -0
- package/src/test.js +187 -0
- package/src/utils/Deferred.js +10 -0
- package/src/utils/EventServer.js +78 -0
- package/src/utils/box.js +101 -0
- package/src/utils/defer.js +33 -0
- package/src/utils/fileSets.js +113 -0
- package/src/utils/formatters.js +30 -0
- package/src/utils/timeout.js +3 -0
- package/src/utils/timer.js +24 -0
- package/src/utils/yamlFormatter.js +150 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import {Env, Unifier, Variable} from '../unify.js';
|
|
2
|
+
import walk, {
|
|
3
|
+
processOther,
|
|
4
|
+
processCircular,
|
|
5
|
+
processMap,
|
|
6
|
+
postMapCircular,
|
|
7
|
+
buildNewMap,
|
|
8
|
+
replaceObject,
|
|
9
|
+
processObject,
|
|
10
|
+
postObjectCircular,
|
|
11
|
+
getObjectData,
|
|
12
|
+
buildNewObject,
|
|
13
|
+
processVariable,
|
|
14
|
+
processCommand
|
|
15
|
+
} from './walk.js';
|
|
16
|
+
|
|
17
|
+
const empty = {};
|
|
18
|
+
|
|
19
|
+
function postProcess(context) {
|
|
20
|
+
const stackOut = context.stackOut,
|
|
21
|
+
s = this.s,
|
|
22
|
+
{descriptors, keys} = getObjectData(s, context);
|
|
23
|
+
let j = stackOut.length - 1;
|
|
24
|
+
const result = keys.some(k => {
|
|
25
|
+
const d = descriptors[k];
|
|
26
|
+
if (d.get || d.set) return false;
|
|
27
|
+
const t = stackOut[j--];
|
|
28
|
+
return typeof t == 'number' && isNaN(t) ? typeof s[k] == 'number' && !isNaN(s[k]) : s[k] !== t;
|
|
29
|
+
});
|
|
30
|
+
if (result) {
|
|
31
|
+
buildNewObject(s, descriptors, keys, stackOut);
|
|
32
|
+
} else {
|
|
33
|
+
replaceObject(j, s, stackOut);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function postProcessSeen(context) {
|
|
38
|
+
const stackOut = context.stackOut,
|
|
39
|
+
s = this.s,
|
|
40
|
+
{descriptors, keys} = getObjectData(s, context);
|
|
41
|
+
let j = stackOut.length - 1;
|
|
42
|
+
const result = keys.some(k => {
|
|
43
|
+
const d = descriptors[k];
|
|
44
|
+
if (d.get || d.set) return false;
|
|
45
|
+
const t = stackOut[j--];
|
|
46
|
+
return typeof t == 'number' && isNaN(t) ? typeof s[k] == 'number' && !isNaN(s[k]) : s[k] !== t;
|
|
47
|
+
});
|
|
48
|
+
if (result) {
|
|
49
|
+
postObjectCircular(s, descriptors, keys, context);
|
|
50
|
+
} else {
|
|
51
|
+
replaceObject(j, s, stackOut);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const postProcessMap = context => {
|
|
56
|
+
const stackOut = context.stackOut,
|
|
57
|
+
s = this.s;
|
|
58
|
+
let j = stackOut.length - 1;
|
|
59
|
+
const result = Array.from(s.values()).some(v => {
|
|
60
|
+
const t = stackOut[j--];
|
|
61
|
+
return typeof t == 'number' && isNaN(t) ? typeof v == 'number' && !isNaN(v) : v !== t;
|
|
62
|
+
});
|
|
63
|
+
if (result) {
|
|
64
|
+
buildNewMap(s.keys(), stackOut);
|
|
65
|
+
} else {
|
|
66
|
+
replaceObject(j, s, stackOut);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
function postProcessMapSeen(context) {
|
|
71
|
+
const stackOut = context.stackOut,
|
|
72
|
+
s = this.s;
|
|
73
|
+
let j = stackOut.length - 1;
|
|
74
|
+
const result = Array.from(s.values()).some(v => {
|
|
75
|
+
const t = stackOut[j--];
|
|
76
|
+
return typeof t == 'number' && isNaN(t) ? typeof v == 'number' && !isNaN(v) : v !== t;
|
|
77
|
+
});
|
|
78
|
+
if (result) {
|
|
79
|
+
postMapCircular(s, context);
|
|
80
|
+
} else {
|
|
81
|
+
replaceObject(j, s, stackOut);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const registry = [
|
|
86
|
+
walk.Command,
|
|
87
|
+
processCommand,
|
|
88
|
+
Array,
|
|
89
|
+
processObject(postProcess, postProcessSeen),
|
|
90
|
+
Variable,
|
|
91
|
+
processVariable,
|
|
92
|
+
Unifier,
|
|
93
|
+
processOther,
|
|
94
|
+
Date,
|
|
95
|
+
processOther,
|
|
96
|
+
RegExp,
|
|
97
|
+
processOther,
|
|
98
|
+
Map,
|
|
99
|
+
processMap(postProcessMap, postProcessMapSeen),
|
|
100
|
+
Set,
|
|
101
|
+
processOther,
|
|
102
|
+
Promise,
|
|
103
|
+
processOther
|
|
104
|
+
],
|
|
105
|
+
filters = [];
|
|
106
|
+
|
|
107
|
+
// add more types
|
|
108
|
+
|
|
109
|
+
const addType = (Type, process) => registry.push(Type, process || processOther);
|
|
110
|
+
|
|
111
|
+
typeof Int8Array == 'function' && addType(Int8Array);
|
|
112
|
+
typeof Uint8Array == 'function' && addType(Uint8Array);
|
|
113
|
+
typeof Uint8ClampedArray == 'function' && addType(Uint8ClampedArray);
|
|
114
|
+
typeof Int16Array == 'function' && addType(Int16Array);
|
|
115
|
+
typeof Uint16Array == 'function' && addType(Uint16Array);
|
|
116
|
+
typeof Int32Array == 'function' && addType(Int32Array);
|
|
117
|
+
typeof Uint32Array == 'function' && addType(Uint32Array);
|
|
118
|
+
typeof Float32Array == 'function' && addType(Float32Array);
|
|
119
|
+
typeof Float64Array == 'function' && addType(Float64Array);
|
|
120
|
+
typeof BigInt64Array == 'function' && addType(BigInt64Array);
|
|
121
|
+
typeof BigUint64Array == 'function' && addType(BigUint64Array);
|
|
122
|
+
typeof DataView == 'function' && addType(DataView);
|
|
123
|
+
typeof ArrayBuffer == 'function' && addType(ArrayBuffer);
|
|
124
|
+
|
|
125
|
+
// main
|
|
126
|
+
|
|
127
|
+
const assemble = (source, env, options) => {
|
|
128
|
+
if (env && !(env instanceof Env)) {
|
|
129
|
+
options = env;
|
|
130
|
+
env = null;
|
|
131
|
+
}
|
|
132
|
+
options = options || empty;
|
|
133
|
+
|
|
134
|
+
const context = options.context || {},
|
|
135
|
+
stackOut = [];
|
|
136
|
+
context.stackOut = stackOut;
|
|
137
|
+
context.env = env;
|
|
138
|
+
|
|
139
|
+
walk(source, {
|
|
140
|
+
processObject: options.processObject || processObject(postProcess, postProcessSeen),
|
|
141
|
+
processOther: options.processOther || processOther,
|
|
142
|
+
processCircular: options.processCircular || processCircular,
|
|
143
|
+
registry: options.registry || assemble.registry,
|
|
144
|
+
filters: options.filters || assemble.filters,
|
|
145
|
+
circular: options.circular,
|
|
146
|
+
symbols: options.symbols,
|
|
147
|
+
allProps: options.allProps,
|
|
148
|
+
context: context
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// ice.assert(stackOut.length == 1);
|
|
152
|
+
return stackOut[0];
|
|
153
|
+
};
|
|
154
|
+
assemble.registry = registry;
|
|
155
|
+
assemble.filters = filters;
|
|
156
|
+
|
|
157
|
+
export {registry, filters};
|
|
158
|
+
export default assemble;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {Env, Unifier, Variable} from '../unify.js';
|
|
2
|
+
import walk, {
|
|
3
|
+
processOther,
|
|
4
|
+
processCircular,
|
|
5
|
+
processMap,
|
|
6
|
+
postMapCircular,
|
|
7
|
+
buildNewMap,
|
|
8
|
+
processObject,
|
|
9
|
+
postObjectCircular,
|
|
10
|
+
getObjectData,
|
|
11
|
+
buildNewObject,
|
|
12
|
+
processVariable,
|
|
13
|
+
processCommand
|
|
14
|
+
} from './walk.js';
|
|
15
|
+
|
|
16
|
+
const empty = {};
|
|
17
|
+
|
|
18
|
+
function postProcess(context) {
|
|
19
|
+
const {descriptors, keys} = getObjectData(this.s, context);
|
|
20
|
+
buildNewObject(this.s, descriptors, keys, context.stackOut);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function postProcessSeen(context) {
|
|
24
|
+
const {descriptors, keys} = getObjectData(this.s, context);
|
|
25
|
+
postObjectCircular(this.s, descriptors, keys, context);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function postProcessMap(context) {
|
|
29
|
+
buildNewMap(this.s.keys(), context.stackOut);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function postProcessMapSeen(context) {
|
|
33
|
+
postMapCircular(this.s, context);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const registry = [
|
|
37
|
+
walk.Command,
|
|
38
|
+
processCommand,
|
|
39
|
+
Array,
|
|
40
|
+
processObject(postProcess, postProcessSeen),
|
|
41
|
+
Variable,
|
|
42
|
+
processVariable,
|
|
43
|
+
Unifier,
|
|
44
|
+
processOther,
|
|
45
|
+
Date,
|
|
46
|
+
(val, context) => context.stackOut.push(new Date(val.getTime())),
|
|
47
|
+
RegExp,
|
|
48
|
+
(val, context) => context.stackOut.push(new RegExp(val.source, (val.global ? 'g' : '') + (val.multiline ? 'm' : '') + (val.ignoreCase ? 'i' : ''))),
|
|
49
|
+
Map,
|
|
50
|
+
processMap(postProcessMap, postProcessMapSeen),
|
|
51
|
+
Promise,
|
|
52
|
+
processOther
|
|
53
|
+
],
|
|
54
|
+
filters = [];
|
|
55
|
+
|
|
56
|
+
// add more types
|
|
57
|
+
|
|
58
|
+
const addType = (Type, process) => registry.push(Type, process || ((val, context) => context.stackOut.push(new Type(val))));
|
|
59
|
+
|
|
60
|
+
addType(Set);
|
|
61
|
+
|
|
62
|
+
typeof Int8Array == 'function' && addType(Int8Array);
|
|
63
|
+
typeof Uint8Array == 'function' && addType(Uint8Array);
|
|
64
|
+
typeof Uint8ClampedArray == 'function' && addType(Uint8ClampedArray);
|
|
65
|
+
typeof Int16Array == 'function' && addType(Int16Array);
|
|
66
|
+
typeof Uint16Array == 'function' && addType(Uint16Array);
|
|
67
|
+
typeof Int32Array == 'function' && addType(Int32Array);
|
|
68
|
+
typeof Uint32Array == 'function' && addType(Uint32Array);
|
|
69
|
+
typeof Float32Array == 'function' && addType(Float32Array);
|
|
70
|
+
typeof Float64Array == 'function' && addType(Float64Array);
|
|
71
|
+
typeof BigInt64Array == 'function' && addType(BigInt64Array);
|
|
72
|
+
typeof BigUint64Array == 'function' && addType(BigUint64Array);
|
|
73
|
+
typeof DataView == 'function' && addType(DataView);
|
|
74
|
+
typeof ArrayBuffer == 'function' && addType(ArrayBuffer);
|
|
75
|
+
|
|
76
|
+
// main
|
|
77
|
+
|
|
78
|
+
const clone = (source, env, options) => {
|
|
79
|
+
if (env && !(env instanceof Env)) {
|
|
80
|
+
options = env;
|
|
81
|
+
env = null;
|
|
82
|
+
}
|
|
83
|
+
options = options || empty;
|
|
84
|
+
|
|
85
|
+
const context = options.context || {},
|
|
86
|
+
stackOut = [];
|
|
87
|
+
context.stackOut = stackOut;
|
|
88
|
+
context.env = env;
|
|
89
|
+
|
|
90
|
+
walk(source, {
|
|
91
|
+
processObject: options.processObject || processObject(postProcess, postProcessSeen),
|
|
92
|
+
processOther: options.processOther || processOther,
|
|
93
|
+
processCircular: options.processCircular || processCircular,
|
|
94
|
+
registry: options.registry || clone.registry,
|
|
95
|
+
filters: options.filters || clone.filters,
|
|
96
|
+
circular: options.circular,
|
|
97
|
+
symbols: options.symbols,
|
|
98
|
+
allProps: options.allProps,
|
|
99
|
+
context: context
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// ice.assert(stackOut.length == 1);
|
|
103
|
+
return stackOut[0];
|
|
104
|
+
};
|
|
105
|
+
clone.registry = registry;
|
|
106
|
+
clone.filters = filters;
|
|
107
|
+
|
|
108
|
+
export {registry, filters};
|
|
109
|
+
export default clone;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {Env, Unifier, Variable} from '../unify.js';
|
|
2
|
+
import walk, {processOther, processMap, replaceObject, processObject, getObjectData, processVariable, processCommand} from './walk.js';
|
|
3
|
+
|
|
4
|
+
const empty = {};
|
|
5
|
+
|
|
6
|
+
function postProcess(context) {
|
|
7
|
+
const stackOut = context.stackOut,
|
|
8
|
+
s = this.s,
|
|
9
|
+
{descriptors, keys} = getObjectData(s, context);
|
|
10
|
+
let j = stackOut.length - 1;
|
|
11
|
+
for (const key of keys) {
|
|
12
|
+
const d = descriptors[key];
|
|
13
|
+
if (!(d.get || d.set)) {
|
|
14
|
+
d.value = stackOut[j--];
|
|
15
|
+
Object.defineProperty(s, key, d);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
replaceObject(j, s, stackOut);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function postProcessMap(context) {
|
|
22
|
+
const stackOut = context.stackOut,
|
|
23
|
+
s = this.s;
|
|
24
|
+
let j = stackOut.length - 1;
|
|
25
|
+
for (const key of s) {
|
|
26
|
+
s.set(key, stackOut[j--]);
|
|
27
|
+
}
|
|
28
|
+
replaceObject(j, s, stackOut);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const registry = [
|
|
32
|
+
walk.Command,
|
|
33
|
+
processCommand,
|
|
34
|
+
Array,
|
|
35
|
+
processObject(postProcess),
|
|
36
|
+
Variable,
|
|
37
|
+
processVariable,
|
|
38
|
+
Unifier,
|
|
39
|
+
processOther,
|
|
40
|
+
Date,
|
|
41
|
+
processOther,
|
|
42
|
+
RegExp,
|
|
43
|
+
processOther,
|
|
44
|
+
Map,
|
|
45
|
+
processMap(postProcessMap),
|
|
46
|
+
Set,
|
|
47
|
+
processOther,
|
|
48
|
+
Promise,
|
|
49
|
+
processOther
|
|
50
|
+
],
|
|
51
|
+
filters = [];
|
|
52
|
+
|
|
53
|
+
// add more types
|
|
54
|
+
|
|
55
|
+
const addType = (Type, process) => registry.push(Type, process || processOther);
|
|
56
|
+
|
|
57
|
+
typeof Int8Array == 'function' && addType(Int8Array);
|
|
58
|
+
typeof Uint8Array == 'function' && addType(Uint8Array);
|
|
59
|
+
typeof Uint8ClampedArray == 'function' && addType(Uint8ClampedArray);
|
|
60
|
+
typeof Int16Array == 'function' && addType(Int16Array);
|
|
61
|
+
typeof Uint16Array == 'function' && addType(Uint16Array);
|
|
62
|
+
typeof Int32Array == 'function' && addType(Int32Array);
|
|
63
|
+
typeof Uint32Array == 'function' && addType(Uint32Array);
|
|
64
|
+
typeof Float32Array == 'function' && addType(Float32Array);
|
|
65
|
+
typeof Float64Array == 'function' && addType(Float64Array);
|
|
66
|
+
typeof BigInt64Array == 'function' && addType(BigInt64Array);
|
|
67
|
+
typeof BigUint64Array == 'function' && addType(BigUint64Array);
|
|
68
|
+
typeof DataView == 'function' && addType(DataView);
|
|
69
|
+
typeof ArrayBuffer == 'function' && addType(ArrayBuffer);
|
|
70
|
+
|
|
71
|
+
// main
|
|
72
|
+
|
|
73
|
+
const deref = (source, env, options) => {
|
|
74
|
+
if (env && !(env instanceof Env)) {
|
|
75
|
+
options = env;
|
|
76
|
+
env = null;
|
|
77
|
+
}
|
|
78
|
+
options = options || empty;
|
|
79
|
+
|
|
80
|
+
const context = options.context || {},
|
|
81
|
+
stackOut = [];
|
|
82
|
+
context.stackOut = stackOut;
|
|
83
|
+
context.env = env;
|
|
84
|
+
|
|
85
|
+
walk(source, {
|
|
86
|
+
processObject: options.processObject || processObject(postProcess),
|
|
87
|
+
processOther: options.processOther || processOther,
|
|
88
|
+
processCircular: options.processCircular || processOther,
|
|
89
|
+
registry: options.registry || deref.registry,
|
|
90
|
+
filters: options.filters || deref.filters,
|
|
91
|
+
circular: options.circular,
|
|
92
|
+
symbols: options.symbols,
|
|
93
|
+
allProps: options.allProps,
|
|
94
|
+
context: context
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// ice.assert(stackOut.length == 1);
|
|
98
|
+
return stackOut[0];
|
|
99
|
+
};
|
|
100
|
+
deref.registry = registry;
|
|
101
|
+
deref.filters = filters;
|
|
102
|
+
|
|
103
|
+
export {registry, filters};
|
|
104
|
+
export default deref;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {Unifier, Variable, open} from '../unify.js';
|
|
2
|
+
import walk, {
|
|
3
|
+
processOther,
|
|
4
|
+
processCircular,
|
|
5
|
+
processMap,
|
|
6
|
+
postMapCircular,
|
|
7
|
+
buildNewMap,
|
|
8
|
+
processObject,
|
|
9
|
+
postObjectCircular,
|
|
10
|
+
getObjectData,
|
|
11
|
+
buildNewObject,
|
|
12
|
+
processCommand
|
|
13
|
+
} from './walk.js';
|
|
14
|
+
|
|
15
|
+
const empty = {};
|
|
16
|
+
|
|
17
|
+
function postProcess(context) {
|
|
18
|
+
const {descriptors, keys} = getObjectData(this.s, context);
|
|
19
|
+
buildNewObject(this.s, descriptors, keys, context.stackOut, context[Array.isArray(this.s) ? 'wrapArray' : 'wrapObject']);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function postProcessSeen(context) {
|
|
23
|
+
const {descriptors, keys} = getObjectData(this.s, context);
|
|
24
|
+
postObjectCircular(this.s, descriptors, keys, context);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function postProcessMap(context) {
|
|
28
|
+
buildNewMap(this.s.keys(), context.stackOut, context.wrapMap);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function postProcessMapSeen(context) {
|
|
32
|
+
postMapCircular(this.s, context);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function processSet(val, context) {
|
|
36
|
+
const wrap = context.wrapSet;
|
|
37
|
+
context.stackOut.push(wrap ? wrap(new Set(val)) : val);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const registry = [
|
|
41
|
+
walk.Command,
|
|
42
|
+
processCommand,
|
|
43
|
+
Array,
|
|
44
|
+
processObject(postProcess, postProcessSeen),
|
|
45
|
+
Variable,
|
|
46
|
+
processOther,
|
|
47
|
+
Unifier,
|
|
48
|
+
processOther,
|
|
49
|
+
Date,
|
|
50
|
+
processOther,
|
|
51
|
+
RegExp,
|
|
52
|
+
processOther,
|
|
53
|
+
Map,
|
|
54
|
+
processMap(postProcessMap, postProcessMapSeen),
|
|
55
|
+
Set,
|
|
56
|
+
processSet,
|
|
57
|
+
Promise,
|
|
58
|
+
processOther
|
|
59
|
+
],
|
|
60
|
+
filters = [];
|
|
61
|
+
|
|
62
|
+
// add more types
|
|
63
|
+
|
|
64
|
+
const addType = (Type, process) => registry.push(Type, process || processOther);
|
|
65
|
+
|
|
66
|
+
typeof Int8Array == 'function' && addType(Int8Array);
|
|
67
|
+
typeof Uint8Array == 'function' && addType(Uint8Array);
|
|
68
|
+
typeof Uint8ClampedArray == 'function' && addType(Uint8ClampedArray);
|
|
69
|
+
typeof Int16Array == 'function' && addType(Int16Array);
|
|
70
|
+
typeof Uint16Array == 'function' && addType(Uint16Array);
|
|
71
|
+
typeof Int32Array == 'function' && addType(Int32Array);
|
|
72
|
+
typeof Uint32Array == 'function' && addType(Uint32Array);
|
|
73
|
+
typeof Float32Array == 'function' && addType(Float32Array);
|
|
74
|
+
typeof Float64Array == 'function' && addType(Float64Array);
|
|
75
|
+
typeof BigInt64Array == 'function' && addType(BigInt64Array);
|
|
76
|
+
typeof BigUint64Array == 'function' && addType(BigUint64Array);
|
|
77
|
+
typeof DataView == 'function' && addType(DataView);
|
|
78
|
+
typeof ArrayBuffer == 'function' && addType(ArrayBuffer);
|
|
79
|
+
|
|
80
|
+
// main
|
|
81
|
+
|
|
82
|
+
const preprocess = (source, options) => {
|
|
83
|
+
options = options || empty;
|
|
84
|
+
|
|
85
|
+
const context = options.context || {},
|
|
86
|
+
stackOut = [];
|
|
87
|
+
context.stackOut = stackOut;
|
|
88
|
+
context.wrapObject = options.openObjects && open;
|
|
89
|
+
context.wrapArray = options.openArrays && open;
|
|
90
|
+
context.wrapMap = options.openMaps && open;
|
|
91
|
+
context.wrapSet = options.openSets && open;
|
|
92
|
+
|
|
93
|
+
walk(source, {
|
|
94
|
+
processObject: options.processObject || processObject(postProcess, postProcessSeen),
|
|
95
|
+
processOther: options.processOther || processOther,
|
|
96
|
+
processCircular: options.processCircular || processCircular,
|
|
97
|
+
registry: options.registry || preprocess.registry,
|
|
98
|
+
filters: options.filters || preprocess.filters,
|
|
99
|
+
circular: options.circular,
|
|
100
|
+
symbols: options.symbols,
|
|
101
|
+
allProps: options.allProps,
|
|
102
|
+
context: context
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// ice.assert(stackOut.length == 1);
|
|
106
|
+
return stackOut[0];
|
|
107
|
+
};
|
|
108
|
+
preprocess.registry = registry;
|
|
109
|
+
preprocess.filters = filters;
|
|
110
|
+
|
|
111
|
+
export {registry, filters};
|
|
112
|
+
export default preprocess;
|