deep6 1.1.3 → 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 +44 -38
- 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 -227
- package/cjs/index.js +0 -57
- package/cjs/package.json +0 -1
- package/cjs/traverse/assemble.js +0 -145
- package/cjs/traverse/clone.js +0 -94
- package/cjs/traverse/deref.js +0 -102
- package/cjs/traverse/preprocess.js +0 -96
- package/cjs/traverse/walk.js +0 -330
- package/cjs/unifiers/matchCondition.js +0 -25
- package/cjs/unifiers/matchInstanceOf.js +0 -25
- package/cjs/unifiers/matchString.js +0 -49
- package/cjs/unifiers/matchTypeOf.js +0 -25
- package/cjs/unifiers/ref.js +0 -30
- package/cjs/unify.js +0 -549
- package/cjs/utils/replaceVars.js +0 -37
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.filters = exports.registry = void 0;
|
|
7
|
-
|
|
8
|
-
var _unify = require("../unify.js");
|
|
9
|
-
|
|
10
|
-
var _walk = _interopRequireWildcard(require("./walk.js"));
|
|
11
|
-
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
|
-
const empty = {};
|
|
17
|
-
|
|
18
|
-
function postProcess(context) {
|
|
19
|
-
const {
|
|
20
|
-
descriptors,
|
|
21
|
-
keys
|
|
22
|
-
} = (0, _walk.getObjectData)(this.s, context);
|
|
23
|
-
(0, _walk.buildNewObject)(this.s, descriptors, keys, context.stackOut, context[Array.isArray(this.s) ? 'wrapArray' : 'wrapObject']);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function postProcessSeen(context) {
|
|
27
|
-
const {
|
|
28
|
-
descriptors,
|
|
29
|
-
keys
|
|
30
|
-
} = (0, _walk.getObjectData)(this.s, context);
|
|
31
|
-
(0, _walk.postObjectCircular)(this.s, descriptors, keys, context);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function postProcessMap(context) {
|
|
35
|
-
(0, _walk.buildNewMap)(this.s.keys(), context.stackOut, context.wrapMap);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function postProcessMapSeen(context) {
|
|
39
|
-
(0, _walk.postMapCircular)(this.s, context);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function processSet(val, context) {
|
|
43
|
-
const wrap = context.wrapSet;
|
|
44
|
-
context.stackOut.push(wrap ? wrap(new Set(val)) : val);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const 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],
|
|
48
|
-
filters = []; // add more types
|
|
49
|
-
|
|
50
|
-
exports.filters = filters;
|
|
51
|
-
exports.registry = registry;
|
|
52
|
-
|
|
53
|
-
const addType = (Type, process) => registry.push(Type, process || _walk.processOther);
|
|
54
|
-
|
|
55
|
-
typeof Int8Array == 'function' && addType(Int8Array);
|
|
56
|
-
typeof Uint8Array == 'function' && addType(Uint8Array);
|
|
57
|
-
typeof Uint8ClampedArray == 'function' && addType(Uint8ClampedArray);
|
|
58
|
-
typeof Int16Array == 'function' && addType(Int16Array);
|
|
59
|
-
typeof Uint16Array == 'function' && addType(Uint16Array);
|
|
60
|
-
typeof Int32Array == 'function' && addType(Int32Array);
|
|
61
|
-
typeof Uint32Array == 'function' && addType(Uint32Array);
|
|
62
|
-
typeof Float32Array == 'function' && addType(Float32Array);
|
|
63
|
-
typeof Float64Array == 'function' && addType(Float64Array);
|
|
64
|
-
typeof BigInt64Array == 'function' && addType(BigInt64Array);
|
|
65
|
-
typeof BigUint64Array == 'function' && addType(BigUint64Array);
|
|
66
|
-
typeof DataView == 'function' && addType(DataView);
|
|
67
|
-
typeof ArrayBuffer == 'function' && addType(ArrayBuffer); // main
|
|
68
|
-
|
|
69
|
-
const preprocess = (source, options) => {
|
|
70
|
-
options = options || empty;
|
|
71
|
-
const context = options.context || {},
|
|
72
|
-
stackOut = [];
|
|
73
|
-
context.stackOut = stackOut;
|
|
74
|
-
context.wrapObject = options.openObjects && _unify.open;
|
|
75
|
-
context.wrapArray = options.openArrays && _unify.open;
|
|
76
|
-
context.wrapMap = options.openMaps && _unify.open;
|
|
77
|
-
context.wrapSet = options.openSets && _unify.open;
|
|
78
|
-
(0, _walk.default)(source, {
|
|
79
|
-
processObject: options.processObject || (0, _walk.processObject)(postProcess, postProcessSeen),
|
|
80
|
-
processOther: options.processOther || _walk.processOther,
|
|
81
|
-
processCircular: options.processCircular || _walk.processCircular,
|
|
82
|
-
registry: options.registry || preprocess.registry,
|
|
83
|
-
filters: options.filters || preprocess.filters,
|
|
84
|
-
circular: options.circular,
|
|
85
|
-
symbols: options.symbols,
|
|
86
|
-
allProps: options.allProps,
|
|
87
|
-
context: context
|
|
88
|
-
}); // ice.assert(stackOut.length == 1);
|
|
89
|
-
|
|
90
|
-
return stackOut[0];
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
preprocess.registry = registry;
|
|
94
|
-
preprocess.filters = filters;
|
|
95
|
-
var _default = preprocess;
|
|
96
|
-
exports.default = _default;
|
package/cjs/traverse/walk.js
DELETED
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.processCommand = exports.processVariable = exports.buildNewObject = exports.getObjectData = exports.postObjectCircular = exports.processObject = exports.replaceObject = exports.buildNewMap = exports.processCircular = exports.processOther = exports.postMapCircular = exports.processMap = exports.setObject = exports.Circular = exports.filters = exports.registry = exports.Command = void 0;
|
|
7
|
-
|
|
8
|
-
var _unify = require("../unify.js");
|
|
9
|
-
|
|
10
|
-
const empty = {};
|
|
11
|
-
|
|
12
|
-
const nop = () => {}; // public utilities to build walkers
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class Circular {
|
|
16
|
-
constructor(value) {
|
|
17
|
-
this.value = value;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
exports.Circular = Circular;
|
|
23
|
-
|
|
24
|
-
const setObject = (seen, source, value) => {
|
|
25
|
-
const record = seen.get(source);
|
|
26
|
-
|
|
27
|
-
if (record) {
|
|
28
|
-
record.actions.forEach(([object, key]) => {
|
|
29
|
-
if (object instanceof Map) {
|
|
30
|
-
object.set(key, value);
|
|
31
|
-
} else {
|
|
32
|
-
const d = Object.getOwnPropertyDescriptor(object, key);
|
|
33
|
-
d.value = value;
|
|
34
|
-
Object.defineProperty(object, key, d);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
seen.set(source, {
|
|
40
|
-
value
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
exports.setObject = setObject;
|
|
45
|
-
|
|
46
|
-
const processOther = (value, context) => context.stackOut.push(value);
|
|
47
|
-
|
|
48
|
-
exports.processOther = processOther;
|
|
49
|
-
|
|
50
|
-
const processCircular = (value, context) => context.stackOut.push(new Circular(value));
|
|
51
|
-
|
|
52
|
-
exports.processCircular = processCircular;
|
|
53
|
-
|
|
54
|
-
const processMap = (postProcess, postProcessSeen) => (object, context) => {
|
|
55
|
-
const stack = context.stack;
|
|
56
|
-
postProcess && stack.push(new Command(postProcessSeen ? context.seen ? postProcessSeen : postProcess : postProcess, object));
|
|
57
|
-
|
|
58
|
-
for (const value of object.values()) {
|
|
59
|
-
stack.push(value);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
exports.processMap = processMap;
|
|
64
|
-
|
|
65
|
-
const postMapCircular = (source, context) => {
|
|
66
|
-
const {
|
|
67
|
-
stackOut,
|
|
68
|
-
seen,
|
|
69
|
-
wrapMap
|
|
70
|
-
} = context,
|
|
71
|
-
t = new Map();
|
|
72
|
-
|
|
73
|
-
for (const k of source.keys()) {
|
|
74
|
-
const value = stackOut.pop();
|
|
75
|
-
|
|
76
|
-
if (!(value instanceof Circular)) {
|
|
77
|
-
t.set(k, value);
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const record = seen.get(value.value);
|
|
82
|
-
|
|
83
|
-
if (record) {
|
|
84
|
-
if (record.actions) {
|
|
85
|
-
record.actions.push([t, k]);
|
|
86
|
-
} else {
|
|
87
|
-
t.set(k, record.value);
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
seen.set(value.value, {
|
|
91
|
-
actions: [[t, k]]
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const o = wrapMap ? wrapMap(t) : t;
|
|
97
|
-
setObject(seen, source, o);
|
|
98
|
-
stackOut.push(o);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
exports.postMapCircular = postMapCircular;
|
|
102
|
-
|
|
103
|
-
const buildNewMap = (keys, stackOut, wrap) => {
|
|
104
|
-
const t = new Map();
|
|
105
|
-
|
|
106
|
-
for (const k of keys) {
|
|
107
|
-
t.set(k, stackOut.pop());
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
stackOut.push(wrap ? wrap(t) : t);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
exports.buildNewMap = buildNewMap;
|
|
114
|
-
|
|
115
|
-
const replaceObject = (upTo, object, stackOut) => {
|
|
116
|
-
const l = stackOut.length - 1 - upTo;
|
|
117
|
-
|
|
118
|
-
if (l) {
|
|
119
|
-
stackOut.splice(-l, l, object);
|
|
120
|
-
} else {
|
|
121
|
-
stackOut.push(object);
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
exports.replaceObject = replaceObject;
|
|
126
|
-
|
|
127
|
-
const processObject = (postProcess, postProcessSeen) => (object, context) => {
|
|
128
|
-
const stack = context.stack;
|
|
129
|
-
postProcess && stack.push(new Command(postProcessSeen ? context.seen ? postProcessSeen : postProcess : postProcess, object));
|
|
130
|
-
const {
|
|
131
|
-
descriptors,
|
|
132
|
-
keys
|
|
133
|
-
} = getObjectData(object, context);
|
|
134
|
-
|
|
135
|
-
for (const k of keys) {
|
|
136
|
-
const d = descriptors[k];
|
|
137
|
-
!(d.get || d.set) && stack.push(d.value);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
exports.processObject = processObject;
|
|
142
|
-
|
|
143
|
-
const postObjectCircular = (source, descriptors, keys, context) => {
|
|
144
|
-
const {
|
|
145
|
-
stackOut,
|
|
146
|
-
seen
|
|
147
|
-
} = context,
|
|
148
|
-
isArray = Array.isArray(source),
|
|
149
|
-
wrap = context[isArray ? 'wrapArray' : 'wrapObject'],
|
|
150
|
-
t = isArray ? [] : Object.create(Object.getPrototypeOf(source));
|
|
151
|
-
|
|
152
|
-
for (const k of keys) {
|
|
153
|
-
const d = descriptors[k];
|
|
154
|
-
|
|
155
|
-
if (d.get || d.set) {
|
|
156
|
-
Object.defineProperty(t, k, d);
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const value = stackOut.pop();
|
|
161
|
-
|
|
162
|
-
if (!(value instanceof Circular)) {
|
|
163
|
-
d.value = value;
|
|
164
|
-
Object.defineProperty(t, k, d);
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const record = seen.get(value.value);
|
|
169
|
-
|
|
170
|
-
if (record) {
|
|
171
|
-
if (record.actions) {
|
|
172
|
-
record.actions.push([t, k]);
|
|
173
|
-
d.value = null;
|
|
174
|
-
} else {
|
|
175
|
-
d.value = record.value;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
Object.defineProperty(t, k, d);
|
|
179
|
-
continue;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
seen.set(value.value, {
|
|
183
|
-
actions: [[t, k]]
|
|
184
|
-
});
|
|
185
|
-
d.value = null;
|
|
186
|
-
Object.defineProperty(t, k, d);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const o = wrap ? wrap(t) : t;
|
|
190
|
-
setObject(seen, source, o);
|
|
191
|
-
stackOut.push(o);
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
exports.postObjectCircular = postObjectCircular;
|
|
195
|
-
|
|
196
|
-
const getObjectData = (object, context) => {
|
|
197
|
-
const descriptors = Object.getOwnPropertyDescriptors(object);
|
|
198
|
-
if (Array.isArray(object)) delete descriptors.length;
|
|
199
|
-
let keys = Object.keys(descriptors);
|
|
200
|
-
if (context.symbols) keys = keys.concat(Object.getOwnPropertySymbols(descriptors));
|
|
201
|
-
if (!context.allProps) keys = keys.filter(key => descriptors[key].enumerable);
|
|
202
|
-
return {
|
|
203
|
-
descriptors,
|
|
204
|
-
keys
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
exports.getObjectData = getObjectData;
|
|
209
|
-
|
|
210
|
-
const buildNewObject = (source, descriptors, keys, stackOut, wrap) => {
|
|
211
|
-
const t = Array.isArray(source) ? [] : Object.create(Object.getPrototypeOf(source));
|
|
212
|
-
|
|
213
|
-
for (const k of keys) {
|
|
214
|
-
const d = descriptors[k];
|
|
215
|
-
|
|
216
|
-
if (!(d.get || d.set)) {
|
|
217
|
-
d.value = stackOut.pop();
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
Object.defineProperty(t, k, d);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
stackOut.push(wrap ? wrap(t) : t);
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
exports.buildNewObject = buildNewObject;
|
|
227
|
-
|
|
228
|
-
const processVariable = (val, context) => {
|
|
229
|
-
const env = context.env;
|
|
230
|
-
|
|
231
|
-
if (val.isBound(env)) {
|
|
232
|
-
context.stack.push(val.get(env));
|
|
233
|
-
} else {
|
|
234
|
-
context.stackOut.push(val);
|
|
235
|
-
}
|
|
236
|
-
}; // implementation
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
exports.processVariable = processVariable;
|
|
240
|
-
|
|
241
|
-
class Command {
|
|
242
|
-
constructor(f, s) {
|
|
243
|
-
this.f = f;
|
|
244
|
-
this.s = s;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
exports.Command = Command;
|
|
250
|
-
|
|
251
|
-
const processCommand = (val, context) => val.f(context);
|
|
252
|
-
|
|
253
|
-
exports.processCommand = processCommand;
|
|
254
|
-
const defaultRegistry = [Command, processCommand, Array, processObject(), Date, nop, RegExp, nop, Map, processMap(), Set, nop, Promise, nop],
|
|
255
|
-
defaultFilters = []; // add more types
|
|
256
|
-
|
|
257
|
-
exports.filters = defaultFilters;
|
|
258
|
-
exports.registry = defaultRegistry;
|
|
259
|
-
|
|
260
|
-
const addType = (Type, process) => defaultRegistry.push(Type, process || nop);
|
|
261
|
-
|
|
262
|
-
typeof Int8Array == 'function' && addType(Int8Array);
|
|
263
|
-
typeof Uint8Array == 'function' && addType(Uint8Array);
|
|
264
|
-
typeof Uint8ClampedArray == 'function' && addType(Uint8ClampedArray);
|
|
265
|
-
typeof Int16Array == 'function' && addType(Int16Array);
|
|
266
|
-
typeof Uint16Array == 'function' && addType(Uint16Array);
|
|
267
|
-
typeof Int32Array == 'function' && addType(Int32Array);
|
|
268
|
-
typeof Uint32Array == 'function' && addType(Uint32Array);
|
|
269
|
-
typeof Float32Array == 'function' && addType(Float32Array);
|
|
270
|
-
typeof Float64Array == 'function' && addType(Float64Array);
|
|
271
|
-
typeof BigInt64Array == 'function' && addType(BigInt64Array);
|
|
272
|
-
typeof BigUint64Array == 'function' && addType(BigUint64Array);
|
|
273
|
-
typeof DataView == 'function' && addType(DataView);
|
|
274
|
-
typeof ArrayBuffer == 'function' && addType(ArrayBuffer); // main
|
|
275
|
-
|
|
276
|
-
const walk = (o, options) => {
|
|
277
|
-
// non-recursive stack-based walk about an object tree
|
|
278
|
-
options = options || empty;
|
|
279
|
-
const doObject = options.processObject || processObject(),
|
|
280
|
-
doOther = options.processOther || nop,
|
|
281
|
-
doCircular = options.processCircular || nop,
|
|
282
|
-
registry = options.registry || defaultRegistry,
|
|
283
|
-
filters = options.filters || defaultFilters,
|
|
284
|
-
context = options.context || {},
|
|
285
|
-
stack = [o],
|
|
286
|
-
seen = options.circular ? new Map() : null;
|
|
287
|
-
context.stack = stack;
|
|
288
|
-
context.seen = seen;
|
|
289
|
-
context.symbols = options.symbols;
|
|
290
|
-
context.allProps = options.allProps;
|
|
291
|
-
|
|
292
|
-
main: while (stack.length) {
|
|
293
|
-
o = stack.pop();
|
|
294
|
-
|
|
295
|
-
if (!o || typeof o != 'object' || o === _unify._) {
|
|
296
|
-
doOther(o, context);
|
|
297
|
-
continue;
|
|
298
|
-
} // process circular dependencies
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (seen) {
|
|
302
|
-
if (seen.has(o)) {
|
|
303
|
-
doCircular(o, context);
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
seen.set(o, null);
|
|
308
|
-
} // process registered constructors
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
for (let i = 0; i < registry.length; i += 2) {
|
|
312
|
-
if (o instanceof registry[i]) {
|
|
313
|
-
registry[i + 1](o, context);
|
|
314
|
-
continue main;
|
|
315
|
-
}
|
|
316
|
-
} // process registered filters
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
for (let i = 0; i < filters.length; ++i) {
|
|
320
|
-
if (filters[i](o, context)) continue main;
|
|
321
|
-
} // process naked objects
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
doObject(o, context);
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
walk.Command = Command;
|
|
329
|
-
var _default = walk;
|
|
330
|
-
exports.default = _default;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _env = require("../env.js");
|
|
9
|
-
|
|
10
|
-
class MatchCondition extends _env.Unifier {
|
|
11
|
-
constructor(f) {
|
|
12
|
-
super();
|
|
13
|
-
this.f = f;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
unify(val, ls, rs, env) {
|
|
17
|
-
return this.f(val, ls, rs, env);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const matchCondition = f => new MatchCondition(f);
|
|
23
|
-
|
|
24
|
-
var _default = matchCondition;
|
|
25
|
-
exports.default = _default;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _env = require("../env.js");
|
|
9
|
-
|
|
10
|
-
class MatchInstanceOf extends _env.Unifier {
|
|
11
|
-
constructor(types) {
|
|
12
|
-
super();
|
|
13
|
-
this.types = types instanceof Array ? types : [types];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
unify(val, ls, rs) {
|
|
17
|
-
return val && !(0, _env.isVariable)(val) && this.types.some(type => val instanceof type);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const matchInstanceOf = types => new MatchInstanceOf(types);
|
|
23
|
-
|
|
24
|
-
var _default = matchInstanceOf;
|
|
25
|
-
exports.default = _default;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _env = require("../env.js");
|
|
9
|
-
|
|
10
|
-
class MatchString extends _env.Unifier {
|
|
11
|
-
constructor(regexp, matches, props) {
|
|
12
|
-
super();
|
|
13
|
-
this.regexp = regexp;
|
|
14
|
-
this.matches = matches;
|
|
15
|
-
this.props = props;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
unify(val, ls, rs) {
|
|
19
|
-
if ((0, _env.isVariable)(val)) {
|
|
20
|
-
// cannot match with an unbound variable
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const result = this.regexp.exec('' + val);
|
|
25
|
-
|
|
26
|
-
if (result) {
|
|
27
|
-
if (this.matches) {
|
|
28
|
-
ls.push(this.matches);
|
|
29
|
-
rs.push(Array.prototype.slice.call(result, 0));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (this.props) {
|
|
33
|
-
ls.push(this.props);
|
|
34
|
-
rs.push({
|
|
35
|
-
index: result.index,
|
|
36
|
-
input: result.input
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const matchString = (regexp, matches, props) => new MatchString(regexp, matches, props);
|
|
47
|
-
|
|
48
|
-
var _default = matchString;
|
|
49
|
-
exports.default = _default;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _env = require("../env.js");
|
|
9
|
-
|
|
10
|
-
class MatchTypeOf extends _env.Unifier {
|
|
11
|
-
constructor(types) {
|
|
12
|
-
super();
|
|
13
|
-
this.types = types instanceof Array ? types : [types];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
unify(val, ls, rs) {
|
|
17
|
-
return !(0, _env.isVariable)(val) && this.types.indexOf(typeof val) >= 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const matchTypeOf = types => new MatchTypeOf(types);
|
|
23
|
-
|
|
24
|
-
var _default = matchTypeOf;
|
|
25
|
-
exports.default = _default;
|
package/cjs/unifiers/ref.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _env = require("../env.js");
|
|
9
|
-
|
|
10
|
-
class Ref extends _env.Variable {
|
|
11
|
-
constructor(variable, value) {
|
|
12
|
-
const v = typeof variable == 'string' ? new _env.Variable(variable) : variable;
|
|
13
|
-
super(v.name);
|
|
14
|
-
this.variable = v;
|
|
15
|
-
this.value = value;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
unify(val, ls, rs, env) {
|
|
19
|
-
ls.push(this.value, this.variable);
|
|
20
|
-
rs.push(val, val);
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const ref = (variable, value) => new Ref(variable, value);
|
|
27
|
-
|
|
28
|
-
ref.Ref = Ref;
|
|
29
|
-
var _default = ref;
|
|
30
|
-
exports.default = _default;
|