deep6 1.1.2 → 1.1.4

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