immutable 4.0.0-rc.8 → 4.1.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 +256 -175
- package/dist/immutable.d.ts +1404 -923
- package/dist/immutable.es.js +821 -644
- package/dist/immutable.js +5103 -4917
- package/dist/immutable.js.flow +985 -290
- package/dist/immutable.min.js +53 -36
- package/package.json +8 -98
- package/contrib/cursor/README.md +0 -43
- package/contrib/cursor/__tests__/Cursor.ts.skip +0 -395
- package/contrib/cursor/index.d.ts +0 -287
- package/contrib/cursor/index.js +0 -360
- package/dist/immutable-nonambient.d.ts +0 -5151
package/dist/immutable.es.js
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2014-present, Lee Byron and other contributors.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
6
23
|
*/
|
|
7
|
-
|
|
8
|
-
// Used for setting prototype methods that IE8 chokes on.
|
|
9
24
|
var DELETE = 'delete';
|
|
10
25
|
|
|
11
26
|
// Constants describing the size of trie nodes.
|
|
@@ -18,16 +33,14 @@ var MASK = SIZE - 1;
|
|
|
18
33
|
var NOT_SET = {};
|
|
19
34
|
|
|
20
35
|
// Boolean references, Rough equivalent of `bool &`.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function MakeRef(ref) {
|
|
25
|
-
ref.value = false;
|
|
26
|
-
return ref;
|
|
36
|
+
function MakeRef() {
|
|
37
|
+
return { value: false };
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
function SetRef(ref) {
|
|
30
|
-
|
|
41
|
+
if (ref) {
|
|
42
|
+
ref.value = true;
|
|
43
|
+
}
|
|
31
44
|
}
|
|
32
45
|
|
|
33
46
|
// A function which returns a value representing an "owner" for transient writes
|
|
@@ -86,10 +99,12 @@ function resolveIndex(index, size, defaultIndex) {
|
|
|
86
99
|
return index === undefined
|
|
87
100
|
? defaultIndex
|
|
88
101
|
: isNeg(index)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
? size === Infinity
|
|
103
|
+
? size
|
|
104
|
+
: Math.max(0, size + index) | 0
|
|
105
|
+
: size === undefined || size === index
|
|
106
|
+
? index
|
|
107
|
+
: Math.min(size, index) | 0;
|
|
93
108
|
}
|
|
94
109
|
|
|
95
110
|
function isNeg(value) {
|
|
@@ -97,53 +112,33 @@ function isNeg(value) {
|
|
|
97
112
|
return value < 0 || (value === 0 && 1 / value === -Infinity);
|
|
98
113
|
}
|
|
99
114
|
|
|
100
|
-
|
|
101
|
-
return isCollection(maybeImmutable) || isRecord(maybeImmutable);
|
|
102
|
-
}
|
|
115
|
+
var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
|
|
103
116
|
|
|
104
117
|
function isCollection(maybeCollection) {
|
|
105
|
-
return
|
|
118
|
+
return Boolean(maybeCollection && maybeCollection[IS_COLLECTION_SYMBOL]);
|
|
106
119
|
}
|
|
107
120
|
|
|
121
|
+
var IS_KEYED_SYMBOL = '@@__IMMUTABLE_KEYED__@@';
|
|
122
|
+
|
|
108
123
|
function isKeyed(maybeKeyed) {
|
|
109
|
-
return
|
|
124
|
+
return Boolean(maybeKeyed && maybeKeyed[IS_KEYED_SYMBOL]);
|
|
110
125
|
}
|
|
111
126
|
|
|
127
|
+
var IS_INDEXED_SYMBOL = '@@__IMMUTABLE_INDEXED__@@';
|
|
128
|
+
|
|
112
129
|
function isIndexed(maybeIndexed) {
|
|
113
|
-
return
|
|
130
|
+
return Boolean(maybeIndexed && maybeIndexed[IS_INDEXED_SYMBOL]);
|
|
114
131
|
}
|
|
115
132
|
|
|
116
133
|
function isAssociative(maybeAssociative) {
|
|
117
134
|
return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);
|
|
118
135
|
}
|
|
119
136
|
|
|
120
|
-
function isOrdered(maybeOrdered) {
|
|
121
|
-
return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function isRecord(maybeRecord) {
|
|
125
|
-
return !!(maybeRecord && maybeRecord[IS_RECORD_SENTINEL]);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function isValueObject(maybeValue) {
|
|
129
|
-
return !!(
|
|
130
|
-
maybeValue &&
|
|
131
|
-
typeof maybeValue.equals === 'function' &&
|
|
132
|
-
typeof maybeValue.hashCode === 'function'
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
|
|
137
|
-
var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
|
|
138
|
-
var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@';
|
|
139
|
-
var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
|
|
140
|
-
var IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@';
|
|
141
|
-
|
|
142
137
|
var Collection = function Collection(value) {
|
|
143
138
|
return isCollection(value) ? value : Seq(value);
|
|
144
139
|
};
|
|
145
140
|
|
|
146
|
-
var KeyedCollection = (function (Collection) {
|
|
141
|
+
var KeyedCollection = /*@__PURE__*/(function (Collection) {
|
|
147
142
|
function KeyedCollection(value) {
|
|
148
143
|
return isKeyed(value) ? value : KeyedSeq(value);
|
|
149
144
|
}
|
|
@@ -155,7 +150,7 @@ var KeyedCollection = (function (Collection) {
|
|
|
155
150
|
return KeyedCollection;
|
|
156
151
|
}(Collection));
|
|
157
152
|
|
|
158
|
-
var IndexedCollection = (function (Collection) {
|
|
153
|
+
var IndexedCollection = /*@__PURE__*/(function (Collection) {
|
|
159
154
|
function IndexedCollection(value) {
|
|
160
155
|
return isIndexed(value) ? value : IndexedSeq(value);
|
|
161
156
|
}
|
|
@@ -167,7 +162,7 @@ var IndexedCollection = (function (Collection) {
|
|
|
167
162
|
return IndexedCollection;
|
|
168
163
|
}(Collection));
|
|
169
164
|
|
|
170
|
-
var SetCollection = (function (Collection) {
|
|
165
|
+
var SetCollection = /*@__PURE__*/(function (Collection) {
|
|
171
166
|
function SetCollection(value) {
|
|
172
167
|
return isCollection(value) && !isAssociative(value) ? value : SetSeq(value);
|
|
173
168
|
}
|
|
@@ -183,6 +178,28 @@ Collection.Keyed = KeyedCollection;
|
|
|
183
178
|
Collection.Indexed = IndexedCollection;
|
|
184
179
|
Collection.Set = SetCollection;
|
|
185
180
|
|
|
181
|
+
var IS_SEQ_SYMBOL = '@@__IMMUTABLE_SEQ__@@';
|
|
182
|
+
|
|
183
|
+
function isSeq(maybeSeq) {
|
|
184
|
+
return Boolean(maybeSeq && maybeSeq[IS_SEQ_SYMBOL]);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
var IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@';
|
|
188
|
+
|
|
189
|
+
function isRecord(maybeRecord) {
|
|
190
|
+
return Boolean(maybeRecord && maybeRecord[IS_RECORD_SYMBOL]);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function isImmutable(maybeImmutable) {
|
|
194
|
+
return isCollection(maybeImmutable) || isRecord(maybeImmutable);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var IS_ORDERED_SYMBOL = '@@__IMMUTABLE_ORDERED__@@';
|
|
198
|
+
|
|
199
|
+
function isOrdered(maybeOrdered) {
|
|
200
|
+
return Boolean(maybeOrdered && maybeOrdered[IS_ORDERED_SYMBOL]);
|
|
201
|
+
}
|
|
202
|
+
|
|
186
203
|
var ITERATE_KEYS = 0;
|
|
187
204
|
var ITERATE_VALUES = 1;
|
|
188
205
|
var ITERATE_ENTRIES = 2;
|
|
@@ -204,10 +221,10 @@ Iterator.KEYS = ITERATE_KEYS;
|
|
|
204
221
|
Iterator.VALUES = ITERATE_VALUES;
|
|
205
222
|
Iterator.ENTRIES = ITERATE_ENTRIES;
|
|
206
223
|
|
|
207
|
-
Iterator.prototype.inspect = Iterator.prototype.toSource = function() {
|
|
224
|
+
Iterator.prototype.inspect = Iterator.prototype.toSource = function () {
|
|
208
225
|
return this.toString();
|
|
209
226
|
};
|
|
210
|
-
Iterator.prototype[ITERATOR_SYMBOL] = function() {
|
|
227
|
+
Iterator.prototype[ITERATOR_SYMBOL] = function () {
|
|
211
228
|
return this;
|
|
212
229
|
};
|
|
213
230
|
|
|
@@ -217,7 +234,7 @@ function iteratorValue(type, k, v, iteratorResult) {
|
|
|
217
234
|
? (iteratorResult.value = value)
|
|
218
235
|
: (iteratorResult = {
|
|
219
236
|
value: value,
|
|
220
|
-
done: false
|
|
237
|
+
done: false,
|
|
221
238
|
});
|
|
222
239
|
return iteratorResult;
|
|
223
240
|
}
|
|
@@ -227,6 +244,11 @@ function iteratorDone() {
|
|
|
227
244
|
}
|
|
228
245
|
|
|
229
246
|
function hasIterator(maybeIterable) {
|
|
247
|
+
if (Array.isArray(maybeIterable)) {
|
|
248
|
+
// IE11 trick as it does not support `Symbol.iterator`
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
|
|
230
252
|
return !!getIteratorFn(maybeIterable);
|
|
231
253
|
}
|
|
232
254
|
|
|
@@ -249,21 +271,48 @@ function getIteratorFn(iterable) {
|
|
|
249
271
|
}
|
|
250
272
|
}
|
|
251
273
|
|
|
274
|
+
function isEntriesIterable(maybeIterable) {
|
|
275
|
+
var iteratorFn = getIteratorFn(maybeIterable);
|
|
276
|
+
return iteratorFn && iteratorFn === maybeIterable.entries;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function isKeysIterable(maybeIterable) {
|
|
280
|
+
var iteratorFn = getIteratorFn(maybeIterable);
|
|
281
|
+
return iteratorFn && iteratorFn === maybeIterable.keys;
|
|
282
|
+
}
|
|
283
|
+
|
|
252
284
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
253
285
|
|
|
254
286
|
function isArrayLike(value) {
|
|
255
|
-
|
|
287
|
+
if (Array.isArray(value) || typeof value === 'string') {
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return (
|
|
292
|
+
value &&
|
|
293
|
+
typeof value === 'object' &&
|
|
294
|
+
Number.isInteger(value.length) &&
|
|
295
|
+
value.length >= 0 &&
|
|
296
|
+
(value.length === 0
|
|
297
|
+
? // Only {length: 0} is considered Array-like.
|
|
298
|
+
Object.keys(value).length === 1
|
|
299
|
+
: // An object is only Array-like if it has a property where the last value
|
|
300
|
+
// in the array-like may be found (which could be undefined).
|
|
301
|
+
value.hasOwnProperty(value.length - 1))
|
|
302
|
+
);
|
|
256
303
|
}
|
|
257
304
|
|
|
258
|
-
var Seq = (function (Collection
|
|
305
|
+
var Seq = /*@__PURE__*/(function (Collection) {
|
|
259
306
|
function Seq(value) {
|
|
260
|
-
return value ===
|
|
307
|
+
return value === undefined || value === null
|
|
261
308
|
? emptySequence()
|
|
262
|
-
: isImmutable(value)
|
|
309
|
+
: isImmutable(value)
|
|
310
|
+
? value.toSeq()
|
|
311
|
+
: seqFromValue(value);
|
|
263
312
|
}
|
|
264
313
|
|
|
265
|
-
if ( Collection
|
|
266
|
-
Seq.prototype = Object.create( Collection
|
|
314
|
+
if ( Collection ) Seq.__proto__ = Collection;
|
|
315
|
+
Seq.prototype = Object.create( Collection && Collection.prototype );
|
|
267
316
|
Seq.prototype.constructor = Seq;
|
|
268
317
|
|
|
269
318
|
Seq.prototype.toSeq = function toSeq () {
|
|
@@ -285,15 +334,13 @@ var Seq = (function (Collection$$1) {
|
|
|
285
334
|
// abstract __iterateUncached(fn, reverse)
|
|
286
335
|
|
|
287
336
|
Seq.prototype.__iterate = function __iterate (fn, reverse) {
|
|
288
|
-
var this$1 = this;
|
|
289
|
-
|
|
290
337
|
var cache = this._cache;
|
|
291
338
|
if (cache) {
|
|
292
339
|
var size = cache.length;
|
|
293
340
|
var i = 0;
|
|
294
341
|
while (i !== size) {
|
|
295
342
|
var entry = cache[reverse ? size - ++i : i++];
|
|
296
|
-
if (fn(entry[1], entry[0], this
|
|
343
|
+
if (fn(entry[1], entry[0], this) === false) {
|
|
297
344
|
break;
|
|
298
345
|
}
|
|
299
346
|
}
|
|
@@ -323,13 +370,17 @@ var Seq = (function (Collection$$1) {
|
|
|
323
370
|
return Seq;
|
|
324
371
|
}(Collection));
|
|
325
372
|
|
|
326
|
-
var KeyedSeq = (function (Seq) {
|
|
373
|
+
var KeyedSeq = /*@__PURE__*/(function (Seq) {
|
|
327
374
|
function KeyedSeq(value) {
|
|
328
|
-
return value ===
|
|
375
|
+
return value === undefined || value === null
|
|
329
376
|
? emptySequence().toKeyedSeq()
|
|
330
377
|
: isCollection(value)
|
|
331
|
-
|
|
332
|
-
|
|
378
|
+
? isKeyed(value)
|
|
379
|
+
? value.toSeq()
|
|
380
|
+
: value.fromEntrySeq()
|
|
381
|
+
: isRecord(value)
|
|
382
|
+
? value.toSeq()
|
|
383
|
+
: keyedSeqFromValue(value);
|
|
333
384
|
}
|
|
334
385
|
|
|
335
386
|
if ( Seq ) KeyedSeq.__proto__ = Seq;
|
|
@@ -343,15 +394,17 @@ var KeyedSeq = (function (Seq) {
|
|
|
343
394
|
return KeyedSeq;
|
|
344
395
|
}(Seq));
|
|
345
396
|
|
|
346
|
-
var IndexedSeq = (function (Seq) {
|
|
397
|
+
var IndexedSeq = /*@__PURE__*/(function (Seq) {
|
|
347
398
|
function IndexedSeq(value) {
|
|
348
|
-
return value ===
|
|
399
|
+
return value === undefined || value === null
|
|
349
400
|
? emptySequence()
|
|
350
401
|
: isCollection(value)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
402
|
+
? isKeyed(value)
|
|
403
|
+
? value.entrySeq()
|
|
404
|
+
: value.toIndexedSeq()
|
|
405
|
+
: isRecord(value)
|
|
406
|
+
? value.toSeq().entrySeq()
|
|
407
|
+
: indexedSeqFromValue(value);
|
|
355
408
|
}
|
|
356
409
|
|
|
357
410
|
if ( Seq ) IndexedSeq.__proto__ = Seq;
|
|
@@ -373,11 +426,10 @@ var IndexedSeq = (function (Seq) {
|
|
|
373
426
|
return IndexedSeq;
|
|
374
427
|
}(Seq));
|
|
375
428
|
|
|
376
|
-
var SetSeq = (function (Seq) {
|
|
429
|
+
var SetSeq = /*@__PURE__*/(function (Seq) {
|
|
377
430
|
function SetSeq(value) {
|
|
378
|
-
return (
|
|
379
|
-
? value
|
|
380
|
-
: IndexedSeq(value)
|
|
431
|
+
return (
|
|
432
|
+
isCollection(value) && !isAssociative(value) ? value : IndexedSeq(value)
|
|
381
433
|
).toSetSeq();
|
|
382
434
|
}
|
|
383
435
|
|
|
@@ -401,13 +453,11 @@ Seq.Keyed = KeyedSeq;
|
|
|
401
453
|
Seq.Set = SetSeq;
|
|
402
454
|
Seq.Indexed = IndexedSeq;
|
|
403
455
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
Seq.prototype[IS_SEQ_SENTINEL] = true;
|
|
456
|
+
Seq.prototype[IS_SEQ_SYMBOL] = true;
|
|
407
457
|
|
|
408
458
|
// #pragma Root Sequences
|
|
409
459
|
|
|
410
|
-
var ArraySeq = (function (IndexedSeq) {
|
|
460
|
+
var ArraySeq = /*@__PURE__*/(function (IndexedSeq) {
|
|
411
461
|
function ArraySeq(array) {
|
|
412
462
|
this._array = array;
|
|
413
463
|
this.size = array.length;
|
|
@@ -422,14 +472,12 @@ var ArraySeq = (function (IndexedSeq) {
|
|
|
422
472
|
};
|
|
423
473
|
|
|
424
474
|
ArraySeq.prototype.__iterate = function __iterate (fn, reverse) {
|
|
425
|
-
var this$1 = this;
|
|
426
|
-
|
|
427
475
|
var array = this._array;
|
|
428
476
|
var size = array.length;
|
|
429
477
|
var i = 0;
|
|
430
478
|
while (i !== size) {
|
|
431
479
|
var ii = reverse ? size - ++i : i++;
|
|
432
|
-
if (fn(array[ii], ii, this
|
|
480
|
+
if (fn(array[ii], ii, this) === false) {
|
|
433
481
|
break;
|
|
434
482
|
}
|
|
435
483
|
}
|
|
@@ -452,9 +500,11 @@ var ArraySeq = (function (IndexedSeq) {
|
|
|
452
500
|
return ArraySeq;
|
|
453
501
|
}(IndexedSeq));
|
|
454
502
|
|
|
455
|
-
var ObjectSeq = (function (KeyedSeq) {
|
|
503
|
+
var ObjectSeq = /*@__PURE__*/(function (KeyedSeq) {
|
|
456
504
|
function ObjectSeq(object) {
|
|
457
|
-
var keys = Object.keys(object)
|
|
505
|
+
var keys = Object.keys(object).concat(
|
|
506
|
+
Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : []
|
|
507
|
+
);
|
|
458
508
|
this._object = object;
|
|
459
509
|
this._keys = keys;
|
|
460
510
|
this.size = keys.length;
|
|
@@ -476,15 +526,13 @@ var ObjectSeq = (function (KeyedSeq) {
|
|
|
476
526
|
};
|
|
477
527
|
|
|
478
528
|
ObjectSeq.prototype.__iterate = function __iterate (fn, reverse) {
|
|
479
|
-
var this$1 = this;
|
|
480
|
-
|
|
481
529
|
var object = this._object;
|
|
482
530
|
var keys = this._keys;
|
|
483
531
|
var size = keys.length;
|
|
484
532
|
var i = 0;
|
|
485
533
|
while (i !== size) {
|
|
486
534
|
var key = keys[reverse ? size - ++i : i++];
|
|
487
|
-
if (fn(object[key], key, this
|
|
535
|
+
if (fn(object[key], key, this) === false) {
|
|
488
536
|
break;
|
|
489
537
|
}
|
|
490
538
|
}
|
|
@@ -507,9 +555,9 @@ var ObjectSeq = (function (KeyedSeq) {
|
|
|
507
555
|
|
|
508
556
|
return ObjectSeq;
|
|
509
557
|
}(KeyedSeq));
|
|
510
|
-
ObjectSeq.prototype[
|
|
558
|
+
ObjectSeq.prototype[IS_ORDERED_SYMBOL] = true;
|
|
511
559
|
|
|
512
|
-
var CollectionSeq = (function (IndexedSeq) {
|
|
560
|
+
var CollectionSeq = /*@__PURE__*/(function (IndexedSeq) {
|
|
513
561
|
function CollectionSeq(collection) {
|
|
514
562
|
this._collection = collection;
|
|
515
563
|
this.size = collection.length || collection.size;
|
|
@@ -520,8 +568,6 @@ var CollectionSeq = (function (IndexedSeq) {
|
|
|
520
568
|
CollectionSeq.prototype.constructor = CollectionSeq;
|
|
521
569
|
|
|
522
570
|
CollectionSeq.prototype.__iterateUncached = function __iterateUncached (fn, reverse) {
|
|
523
|
-
var this$1 = this;
|
|
524
|
-
|
|
525
571
|
if (reverse) {
|
|
526
572
|
return this.cacheResult().__iterate(fn, reverse);
|
|
527
573
|
}
|
|
@@ -531,7 +577,7 @@ var CollectionSeq = (function (IndexedSeq) {
|
|
|
531
577
|
if (isIterator(iterator)) {
|
|
532
578
|
var step;
|
|
533
579
|
while (!(step = iterator.next()).done) {
|
|
534
|
-
if (fn(step.value, iterations++, this
|
|
580
|
+
if (fn(step.value, iterations++, this) === false) {
|
|
535
581
|
break;
|
|
536
582
|
}
|
|
537
583
|
}
|
|
@@ -558,69 +604,8 @@ var CollectionSeq = (function (IndexedSeq) {
|
|
|
558
604
|
return CollectionSeq;
|
|
559
605
|
}(IndexedSeq));
|
|
560
606
|
|
|
561
|
-
var IteratorSeq = (function (IndexedSeq) {
|
|
562
|
-
function IteratorSeq(iterator) {
|
|
563
|
-
this._iterator = iterator;
|
|
564
|
-
this._iteratorCache = [];
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
if ( IndexedSeq ) IteratorSeq.__proto__ = IndexedSeq;
|
|
568
|
-
IteratorSeq.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
|
|
569
|
-
IteratorSeq.prototype.constructor = IteratorSeq;
|
|
570
|
-
|
|
571
|
-
IteratorSeq.prototype.__iterateUncached = function __iterateUncached (fn, reverse) {
|
|
572
|
-
var this$1 = this;
|
|
573
|
-
|
|
574
|
-
if (reverse) {
|
|
575
|
-
return this.cacheResult().__iterate(fn, reverse);
|
|
576
|
-
}
|
|
577
|
-
var iterator = this._iterator;
|
|
578
|
-
var cache = this._iteratorCache;
|
|
579
|
-
var iterations = 0;
|
|
580
|
-
while (iterations < cache.length) {
|
|
581
|
-
if (fn(cache[iterations], iterations++, this$1) === false) {
|
|
582
|
-
return iterations;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
var step;
|
|
586
|
-
while (!(step = iterator.next()).done) {
|
|
587
|
-
var val = step.value;
|
|
588
|
-
cache[iterations] = val;
|
|
589
|
-
if (fn(val, iterations++, this$1) === false) {
|
|
590
|
-
break;
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
return iterations;
|
|
594
|
-
};
|
|
595
|
-
|
|
596
|
-
IteratorSeq.prototype.__iteratorUncached = function __iteratorUncached (type, reverse) {
|
|
597
|
-
if (reverse) {
|
|
598
|
-
return this.cacheResult().__iterator(type, reverse);
|
|
599
|
-
}
|
|
600
|
-
var iterator = this._iterator;
|
|
601
|
-
var cache = this._iteratorCache;
|
|
602
|
-
var iterations = 0;
|
|
603
|
-
return new Iterator(function () {
|
|
604
|
-
if (iterations >= cache.length) {
|
|
605
|
-
var step = iterator.next();
|
|
606
|
-
if (step.done) {
|
|
607
|
-
return step;
|
|
608
|
-
}
|
|
609
|
-
cache[iterations] = step.value;
|
|
610
|
-
}
|
|
611
|
-
return iteratorValue(type, iterations, cache[iterations++]);
|
|
612
|
-
});
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
return IteratorSeq;
|
|
616
|
-
}(IndexedSeq));
|
|
617
|
-
|
|
618
607
|
// # pragma Helper functions
|
|
619
608
|
|
|
620
|
-
function isSeq(maybeSeq) {
|
|
621
|
-
return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
609
|
var EMPTY_SEQ;
|
|
625
610
|
|
|
626
611
|
function emptySequence() {
|
|
@@ -628,11 +613,7 @@ function emptySequence() {
|
|
|
628
613
|
}
|
|
629
614
|
|
|
630
615
|
function keyedSeqFromValue(value) {
|
|
631
|
-
var seq =
|
|
632
|
-
? new ArraySeq(value)
|
|
633
|
-
: isIterator(value)
|
|
634
|
-
? new IteratorSeq(value)
|
|
635
|
-
: hasIterator(value) ? new CollectionSeq(value) : undefined;
|
|
616
|
+
var seq = maybeIndexedSeqFromValue(value);
|
|
636
617
|
if (seq) {
|
|
637
618
|
return seq.fromEntrySeq();
|
|
638
619
|
}
|
|
@@ -658,7 +639,11 @@ function indexedSeqFromValue(value) {
|
|
|
658
639
|
function seqFromValue(value) {
|
|
659
640
|
var seq = maybeIndexedSeqFromValue(value);
|
|
660
641
|
if (seq) {
|
|
661
|
-
return
|
|
642
|
+
return isEntriesIterable(value)
|
|
643
|
+
? seq.fromEntrySeq()
|
|
644
|
+
: isKeysIterable(value)
|
|
645
|
+
? seq.toSetSeq()
|
|
646
|
+
: seq;
|
|
662
647
|
}
|
|
663
648
|
if (typeof value === 'object') {
|
|
664
649
|
return new ObjectSeq(value);
|
|
@@ -671,9 +656,27 @@ function seqFromValue(value) {
|
|
|
671
656
|
function maybeIndexedSeqFromValue(value) {
|
|
672
657
|
return isArrayLike(value)
|
|
673
658
|
? new ArraySeq(value)
|
|
674
|
-
:
|
|
675
|
-
|
|
676
|
-
|
|
659
|
+
: hasIterator(value)
|
|
660
|
+
? new CollectionSeq(value)
|
|
661
|
+
: undefined;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
var IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';
|
|
665
|
+
|
|
666
|
+
function isMap(maybeMap) {
|
|
667
|
+
return Boolean(maybeMap && maybeMap[IS_MAP_SYMBOL]);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
function isOrderedMap(maybeOrderedMap) {
|
|
671
|
+
return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
function isValueObject(maybeValue) {
|
|
675
|
+
return Boolean(
|
|
676
|
+
maybeValue &&
|
|
677
|
+
typeof maybeValue.equals === 'function' &&
|
|
678
|
+
typeof maybeValue.hashCode === 'function'
|
|
679
|
+
);
|
|
677
680
|
}
|
|
678
681
|
|
|
679
682
|
/**
|
|
@@ -777,50 +780,67 @@ function smi(i32) {
|
|
|
777
780
|
return ((i32 >>> 1) & 0x40000000) | (i32 & 0xbfffffff);
|
|
778
781
|
}
|
|
779
782
|
|
|
783
|
+
var defaultValueOf = Object.prototype.valueOf;
|
|
784
|
+
|
|
780
785
|
function hash(o) {
|
|
781
|
-
if (o
|
|
782
|
-
return
|
|
783
|
-
}
|
|
784
|
-
if (typeof o.valueOf === 'function') {
|
|
785
|
-
o = o.valueOf();
|
|
786
|
-
if (o === false || o === null || o === undefined) {
|
|
787
|
-
return 0;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
if (o === true) {
|
|
791
|
-
return 1;
|
|
792
|
-
}
|
|
793
|
-
var type = typeof o;
|
|
794
|
-
if (type === 'number') {
|
|
795
|
-
if (o !== o || o === Infinity) {
|
|
796
|
-
return 0;
|
|
797
|
-
}
|
|
798
|
-
var h = o | 0;
|
|
799
|
-
if (h !== o) {
|
|
800
|
-
h ^= o * 0xffffffff;
|
|
801
|
-
}
|
|
802
|
-
while (o > 0xffffffff) {
|
|
803
|
-
o /= 0xffffffff;
|
|
804
|
-
h ^= o;
|
|
805
|
-
}
|
|
806
|
-
return smi(h);
|
|
807
|
-
}
|
|
808
|
-
if (type === 'string') {
|
|
809
|
-
return o.length > STRING_HASH_CACHE_MIN_STRLEN
|
|
810
|
-
? cachedHashString(o)
|
|
811
|
-
: hashString(o);
|
|
786
|
+
if (o == null) {
|
|
787
|
+
return hashNullish(o);
|
|
812
788
|
}
|
|
789
|
+
|
|
813
790
|
if (typeof o.hashCode === 'function') {
|
|
814
791
|
// Drop any high bits from accidentally long hash codes.
|
|
815
|
-
return smi(o.hashCode());
|
|
792
|
+
return smi(o.hashCode(o));
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
var v = valueOf(o);
|
|
796
|
+
|
|
797
|
+
if (v == null) {
|
|
798
|
+
return hashNullish(v);
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
switch (typeof v) {
|
|
802
|
+
case 'boolean':
|
|
803
|
+
// The hash values for built-in constants are a 1 value for each 5-byte
|
|
804
|
+
// shift region expect for the first, which encodes the value. This
|
|
805
|
+
// reduces the odds of a hash collision for these common values.
|
|
806
|
+
return v ? 0x42108421 : 0x42108420;
|
|
807
|
+
case 'number':
|
|
808
|
+
return hashNumber(v);
|
|
809
|
+
case 'string':
|
|
810
|
+
return v.length > STRING_HASH_CACHE_MIN_STRLEN
|
|
811
|
+
? cachedHashString(v)
|
|
812
|
+
: hashString(v);
|
|
813
|
+
case 'object':
|
|
814
|
+
case 'function':
|
|
815
|
+
return hashJSObj(v);
|
|
816
|
+
case 'symbol':
|
|
817
|
+
return hashSymbol(v);
|
|
818
|
+
default:
|
|
819
|
+
if (typeof v.toString === 'function') {
|
|
820
|
+
return hashString(v.toString());
|
|
821
|
+
}
|
|
822
|
+
throw new Error('Value type ' + typeof v + ' cannot be hashed.');
|
|
816
823
|
}
|
|
817
|
-
|
|
818
|
-
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
function hashNullish(nullish) {
|
|
827
|
+
return nullish === null ? 0x42108422 : /* undefined */ 0x42108423;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
// Compress arbitrarily large numbers into smi hashes.
|
|
831
|
+
function hashNumber(n) {
|
|
832
|
+
if (n !== n || n === Infinity) {
|
|
833
|
+
return 0;
|
|
834
|
+
}
|
|
835
|
+
var hash = n | 0;
|
|
836
|
+
if (hash !== n) {
|
|
837
|
+
hash ^= n * 0xffffffff;
|
|
819
838
|
}
|
|
820
|
-
|
|
821
|
-
|
|
839
|
+
while (n > 0xffffffff) {
|
|
840
|
+
n /= 0xffffffff;
|
|
841
|
+
hash ^= n;
|
|
822
842
|
}
|
|
823
|
-
|
|
843
|
+
return smi(hash);
|
|
824
844
|
}
|
|
825
845
|
|
|
826
846
|
function cachedHashString(string) {
|
|
@@ -852,6 +872,19 @@ function hashString(string) {
|
|
|
852
872
|
return smi(hashed);
|
|
853
873
|
}
|
|
854
874
|
|
|
875
|
+
function hashSymbol(sym) {
|
|
876
|
+
var hashed = symbolMap[sym];
|
|
877
|
+
if (hashed !== undefined) {
|
|
878
|
+
return hashed;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
hashed = nextHash();
|
|
882
|
+
|
|
883
|
+
symbolMap[sym] = hashed;
|
|
884
|
+
|
|
885
|
+
return hashed;
|
|
886
|
+
}
|
|
887
|
+
|
|
855
888
|
function hashJSObj(obj) {
|
|
856
889
|
var hashed;
|
|
857
890
|
if (usingWeakMap) {
|
|
@@ -878,10 +911,7 @@ function hashJSObj(obj) {
|
|
|
878
911
|
}
|
|
879
912
|
}
|
|
880
913
|
|
|
881
|
-
hashed =
|
|
882
|
-
if (objHashUID & 0x40000000) {
|
|
883
|
-
objHashUID = 0;
|
|
884
|
-
}
|
|
914
|
+
hashed = nextHash();
|
|
885
915
|
|
|
886
916
|
if (usingWeakMap) {
|
|
887
917
|
weakMap.set(obj, hashed);
|
|
@@ -892,7 +922,7 @@ function hashJSObj(obj) {
|
|
|
892
922
|
enumerable: false,
|
|
893
923
|
configurable: false,
|
|
894
924
|
writable: false,
|
|
895
|
-
value: hashed
|
|
925
|
+
value: hashed,
|
|
896
926
|
});
|
|
897
927
|
} else if (
|
|
898
928
|
obj.propertyIsEnumerable !== undefined &&
|
|
@@ -902,7 +932,7 @@ function hashJSObj(obj) {
|
|
|
902
932
|
// we'll hijack one of the less-used non-enumerable properties to
|
|
903
933
|
// save our hash on it. Since this is a function it will not show up in
|
|
904
934
|
// `JSON.stringify` which is what we want.
|
|
905
|
-
obj.propertyIsEnumerable = function() {
|
|
935
|
+
obj.propertyIsEnumerable = function () {
|
|
906
936
|
return this.constructor.prototype.propertyIsEnumerable.apply(
|
|
907
937
|
this,
|
|
908
938
|
arguments
|
|
@@ -926,7 +956,7 @@ function hashJSObj(obj) {
|
|
|
926
956
|
var isExtensible = Object.isExtensible;
|
|
927
957
|
|
|
928
958
|
// True if Object.defineProperty works as expected. IE8 fails this test.
|
|
929
|
-
var canDefineProperty = (function() {
|
|
959
|
+
var canDefineProperty = (function () {
|
|
930
960
|
try {
|
|
931
961
|
Object.defineProperty({}, '@', {});
|
|
932
962
|
return true;
|
|
@@ -948,6 +978,20 @@ function getIENodeHash(node) {
|
|
|
948
978
|
}
|
|
949
979
|
}
|
|
950
980
|
|
|
981
|
+
function valueOf(obj) {
|
|
982
|
+
return obj.valueOf !== defaultValueOf && typeof obj.valueOf === 'function'
|
|
983
|
+
? obj.valueOf(obj)
|
|
984
|
+
: obj;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
function nextHash() {
|
|
988
|
+
var nextHash = ++_objHashUID;
|
|
989
|
+
if (_objHashUID & 0x40000000) {
|
|
990
|
+
_objHashUID = 0;
|
|
991
|
+
}
|
|
992
|
+
return nextHash;
|
|
993
|
+
}
|
|
994
|
+
|
|
951
995
|
// If possible, use a WeakMap.
|
|
952
996
|
var usingWeakMap = typeof WeakMap === 'function';
|
|
953
997
|
var weakMap;
|
|
@@ -955,7 +999,9 @@ if (usingWeakMap) {
|
|
|
955
999
|
weakMap = new WeakMap();
|
|
956
1000
|
}
|
|
957
1001
|
|
|
958
|
-
var
|
|
1002
|
+
var symbolMap = Object.create(null);
|
|
1003
|
+
|
|
1004
|
+
var _objHashUID = 0;
|
|
959
1005
|
|
|
960
1006
|
var UID_HASH_KEY = '__immutablehash__';
|
|
961
1007
|
if (typeof Symbol === 'function') {
|
|
@@ -967,15 +1013,15 @@ var STRING_HASH_CACHE_MAX_SIZE = 255;
|
|
|
967
1013
|
var STRING_HASH_CACHE_SIZE = 0;
|
|
968
1014
|
var stringHashCache = {};
|
|
969
1015
|
|
|
970
|
-
var ToKeyedSequence = (function (KeyedSeq
|
|
1016
|
+
var ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq) {
|
|
971
1017
|
function ToKeyedSequence(indexed, useKeys) {
|
|
972
1018
|
this._iter = indexed;
|
|
973
1019
|
this._useKeys = useKeys;
|
|
974
1020
|
this.size = indexed.size;
|
|
975
1021
|
}
|
|
976
1022
|
|
|
977
|
-
if ( KeyedSeq
|
|
978
|
-
ToKeyedSequence.prototype = Object.create( KeyedSeq
|
|
1023
|
+
if ( KeyedSeq ) ToKeyedSequence.__proto__ = KeyedSeq;
|
|
1024
|
+
ToKeyedSequence.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
|
|
979
1025
|
ToKeyedSequence.prototype.constructor = ToKeyedSequence;
|
|
980
1026
|
|
|
981
1027
|
ToKeyedSequence.prototype.get = function get (key, notSetValue) {
|
|
@@ -991,29 +1037,29 @@ var ToKeyedSequence = (function (KeyedSeq$$1) {
|
|
|
991
1037
|
};
|
|
992
1038
|
|
|
993
1039
|
ToKeyedSequence.prototype.reverse = function reverse () {
|
|
994
|
-
var this$1 = this;
|
|
1040
|
+
var this$1$1 = this;
|
|
995
1041
|
|
|
996
1042
|
var reversedSequence = reverseFactory(this, true);
|
|
997
1043
|
if (!this._useKeys) {
|
|
998
|
-
reversedSequence.valueSeq = function () { return this$1._iter.toSeq().reverse(); };
|
|
1044
|
+
reversedSequence.valueSeq = function () { return this$1$1._iter.toSeq().reverse(); };
|
|
999
1045
|
}
|
|
1000
1046
|
return reversedSequence;
|
|
1001
1047
|
};
|
|
1002
1048
|
|
|
1003
1049
|
ToKeyedSequence.prototype.map = function map (mapper, context) {
|
|
1004
|
-
var this$1 = this;
|
|
1050
|
+
var this$1$1 = this;
|
|
1005
1051
|
|
|
1006
1052
|
var mappedSequence = mapFactory(this, mapper, context);
|
|
1007
1053
|
if (!this._useKeys) {
|
|
1008
|
-
mappedSequence.valueSeq = function () { return this$1._iter.toSeq().map(mapper, context); };
|
|
1054
|
+
mappedSequence.valueSeq = function () { return this$1$1._iter.toSeq().map(mapper, context); };
|
|
1009
1055
|
}
|
|
1010
1056
|
return mappedSequence;
|
|
1011
1057
|
};
|
|
1012
1058
|
|
|
1013
1059
|
ToKeyedSequence.prototype.__iterate = function __iterate (fn, reverse) {
|
|
1014
|
-
var this$1 = this;
|
|
1060
|
+
var this$1$1 = this;
|
|
1015
1061
|
|
|
1016
|
-
return this._iter.__iterate(function (v, k) { return fn(v, k, this$1); }, reverse);
|
|
1062
|
+
return this._iter.__iterate(function (v, k) { return fn(v, k, this$1$1); }, reverse);
|
|
1017
1063
|
};
|
|
1018
1064
|
|
|
1019
1065
|
ToKeyedSequence.prototype.__iterator = function __iterator (type, reverse) {
|
|
@@ -1022,16 +1068,16 @@ var ToKeyedSequence = (function (KeyedSeq$$1) {
|
|
|
1022
1068
|
|
|
1023
1069
|
return ToKeyedSequence;
|
|
1024
1070
|
}(KeyedSeq));
|
|
1025
|
-
ToKeyedSequence.prototype[
|
|
1071
|
+
ToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true;
|
|
1026
1072
|
|
|
1027
|
-
var ToIndexedSequence = (function (IndexedSeq
|
|
1073
|
+
var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq) {
|
|
1028
1074
|
function ToIndexedSequence(iter) {
|
|
1029
1075
|
this._iter = iter;
|
|
1030
1076
|
this.size = iter.size;
|
|
1031
1077
|
}
|
|
1032
1078
|
|
|
1033
|
-
if ( IndexedSeq
|
|
1034
|
-
ToIndexedSequence.prototype = Object.create( IndexedSeq
|
|
1079
|
+
if ( IndexedSeq ) ToIndexedSequence.__proto__ = IndexedSeq;
|
|
1080
|
+
ToIndexedSequence.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
|
|
1035
1081
|
ToIndexedSequence.prototype.constructor = ToIndexedSequence;
|
|
1036
1082
|
|
|
1037
1083
|
ToIndexedSequence.prototype.includes = function includes (value) {
|
|
@@ -1039,18 +1085,18 @@ var ToIndexedSequence = (function (IndexedSeq$$1) {
|
|
|
1039
1085
|
};
|
|
1040
1086
|
|
|
1041
1087
|
ToIndexedSequence.prototype.__iterate = function __iterate (fn, reverse) {
|
|
1042
|
-
var this$1 = this;
|
|
1088
|
+
var this$1$1 = this;
|
|
1043
1089
|
|
|
1044
1090
|
var i = 0;
|
|
1045
1091
|
reverse && ensureSize(this);
|
|
1046
1092
|
return this._iter.__iterate(
|
|
1047
|
-
function (v) { return fn(v, reverse ? this$1.size - ++i : i++, this$1); },
|
|
1093
|
+
function (v) { return fn(v, reverse ? this$1$1.size - ++i : i++, this$1$1); },
|
|
1048
1094
|
reverse
|
|
1049
1095
|
);
|
|
1050
1096
|
};
|
|
1051
1097
|
|
|
1052
1098
|
ToIndexedSequence.prototype.__iterator = function __iterator (type, reverse) {
|
|
1053
|
-
var this$1 = this;
|
|
1099
|
+
var this$1$1 = this;
|
|
1054
1100
|
|
|
1055
1101
|
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
|
|
1056
1102
|
var i = 0;
|
|
@@ -1061,7 +1107,7 @@ var ToIndexedSequence = (function (IndexedSeq$$1) {
|
|
|
1061
1107
|
? step
|
|
1062
1108
|
: iteratorValue(
|
|
1063
1109
|
type,
|
|
1064
|
-
reverse ? this$1.size - ++i : i++,
|
|
1110
|
+
reverse ? this$1$1.size - ++i : i++,
|
|
1065
1111
|
step.value,
|
|
1066
1112
|
step
|
|
1067
1113
|
);
|
|
@@ -1071,14 +1117,14 @@ var ToIndexedSequence = (function (IndexedSeq$$1) {
|
|
|
1071
1117
|
return ToIndexedSequence;
|
|
1072
1118
|
}(IndexedSeq));
|
|
1073
1119
|
|
|
1074
|
-
var ToSetSequence = (function (SetSeq
|
|
1120
|
+
var ToSetSequence = /*@__PURE__*/(function (SetSeq) {
|
|
1075
1121
|
function ToSetSequence(iter) {
|
|
1076
1122
|
this._iter = iter;
|
|
1077
1123
|
this.size = iter.size;
|
|
1078
1124
|
}
|
|
1079
1125
|
|
|
1080
|
-
if ( SetSeq
|
|
1081
|
-
ToSetSequence.prototype = Object.create( SetSeq
|
|
1126
|
+
if ( SetSeq ) ToSetSequence.__proto__ = SetSeq;
|
|
1127
|
+
ToSetSequence.prototype = Object.create( SetSeq && SetSeq.prototype );
|
|
1082
1128
|
ToSetSequence.prototype.constructor = ToSetSequence;
|
|
1083
1129
|
|
|
1084
1130
|
ToSetSequence.prototype.has = function has (key) {
|
|
@@ -1086,9 +1132,9 @@ var ToSetSequence = (function (SetSeq$$1) {
|
|
|
1086
1132
|
};
|
|
1087
1133
|
|
|
1088
1134
|
ToSetSequence.prototype.__iterate = function __iterate (fn, reverse) {
|
|
1089
|
-
var this$1 = this;
|
|
1135
|
+
var this$1$1 = this;
|
|
1090
1136
|
|
|
1091
|
-
return this._iter.__iterate(function (v) { return fn(v, v, this$1); }, reverse);
|
|
1137
|
+
return this._iter.__iterate(function (v) { return fn(v, v, this$1$1); }, reverse);
|
|
1092
1138
|
};
|
|
1093
1139
|
|
|
1094
1140
|
ToSetSequence.prototype.__iterator = function __iterator (type, reverse) {
|
|
@@ -1104,14 +1150,14 @@ var ToSetSequence = (function (SetSeq$$1) {
|
|
|
1104
1150
|
return ToSetSequence;
|
|
1105
1151
|
}(SetSeq));
|
|
1106
1152
|
|
|
1107
|
-
var FromEntriesSequence = (function (KeyedSeq
|
|
1153
|
+
var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq) {
|
|
1108
1154
|
function FromEntriesSequence(entries) {
|
|
1109
1155
|
this._iter = entries;
|
|
1110
1156
|
this.size = entries.size;
|
|
1111
1157
|
}
|
|
1112
1158
|
|
|
1113
|
-
if ( KeyedSeq
|
|
1114
|
-
FromEntriesSequence.prototype = Object.create( KeyedSeq
|
|
1159
|
+
if ( KeyedSeq ) FromEntriesSequence.__proto__ = KeyedSeq;
|
|
1160
|
+
FromEntriesSequence.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
|
|
1115
1161
|
FromEntriesSequence.prototype.constructor = FromEntriesSequence;
|
|
1116
1162
|
|
|
1117
1163
|
FromEntriesSequence.prototype.entrySeq = function entrySeq () {
|
|
@@ -1119,7 +1165,7 @@ var FromEntriesSequence = (function (KeyedSeq$$1) {
|
|
|
1119
1165
|
};
|
|
1120
1166
|
|
|
1121
1167
|
FromEntriesSequence.prototype.__iterate = function __iterate (fn, reverse) {
|
|
1122
|
-
var this$1 = this;
|
|
1168
|
+
var this$1$1 = this;
|
|
1123
1169
|
|
|
1124
1170
|
return this._iter.__iterate(function (entry) {
|
|
1125
1171
|
// Check if entry exists first so array access doesn't throw for holes
|
|
@@ -1130,7 +1176,7 @@ var FromEntriesSequence = (function (KeyedSeq$$1) {
|
|
|
1130
1176
|
return fn(
|
|
1131
1177
|
indexedCollection ? entry.get(1) : entry[1],
|
|
1132
1178
|
indexedCollection ? entry.get(0) : entry[0],
|
|
1133
|
-
this$1
|
|
1179
|
+
this$1$1
|
|
1134
1180
|
);
|
|
1135
1181
|
}
|
|
1136
1182
|
}, reverse);
|
|
@@ -1164,14 +1210,18 @@ var FromEntriesSequence = (function (KeyedSeq$$1) {
|
|
|
1164
1210
|
return FromEntriesSequence;
|
|
1165
1211
|
}(KeyedSeq));
|
|
1166
1212
|
|
|
1167
|
-
ToIndexedSequence.prototype.cacheResult =
|
|
1213
|
+
ToIndexedSequence.prototype.cacheResult =
|
|
1214
|
+
ToKeyedSequence.prototype.cacheResult =
|
|
1215
|
+
ToSetSequence.prototype.cacheResult =
|
|
1216
|
+
FromEntriesSequence.prototype.cacheResult =
|
|
1217
|
+
cacheResultThrough;
|
|
1168
1218
|
|
|
1169
1219
|
function flipFactory(collection) {
|
|
1170
1220
|
var flipSequence = makeSequence(collection);
|
|
1171
1221
|
flipSequence._iter = collection;
|
|
1172
1222
|
flipSequence.size = collection.size;
|
|
1173
1223
|
flipSequence.flip = function () { return collection; };
|
|
1174
|
-
flipSequence.reverse = function() {
|
|
1224
|
+
flipSequence.reverse = function () {
|
|
1175
1225
|
var reversedSequence = collection.reverse.apply(this); // super.reverse()
|
|
1176
1226
|
reversedSequence.flip = function () { return collection.reverse(); };
|
|
1177
1227
|
return reversedSequence;
|
|
@@ -1179,12 +1229,12 @@ function flipFactory(collection) {
|
|
|
1179
1229
|
flipSequence.has = function (key) { return collection.includes(key); };
|
|
1180
1230
|
flipSequence.includes = function (key) { return collection.has(key); };
|
|
1181
1231
|
flipSequence.cacheResult = cacheResultThrough;
|
|
1182
|
-
flipSequence.__iterateUncached = function(fn, reverse) {
|
|
1183
|
-
var this$1 = this;
|
|
1232
|
+
flipSequence.__iterateUncached = function (fn, reverse) {
|
|
1233
|
+
var this$1$1 = this;
|
|
1184
1234
|
|
|
1185
|
-
return collection.__iterate(function (v, k) { return fn(k, v, this$1) !== false; }, reverse);
|
|
1235
|
+
return collection.__iterate(function (v, k) { return fn(k, v, this$1$1) !== false; }, reverse);
|
|
1186
1236
|
};
|
|
1187
|
-
flipSequence.__iteratorUncached = function(type, reverse) {
|
|
1237
|
+
flipSequence.__iteratorUncached = function (type, reverse) {
|
|
1188
1238
|
if (type === ITERATE_ENTRIES) {
|
|
1189
1239
|
var iterator = collection.__iterator(type, reverse);
|
|
1190
1240
|
return new Iterator(function () {
|
|
@@ -1215,15 +1265,15 @@ function mapFactory(collection, mapper, context) {
|
|
|
1215
1265
|
? notSetValue
|
|
1216
1266
|
: mapper.call(context, v, key, collection);
|
|
1217
1267
|
};
|
|
1218
|
-
mappedSequence.__iterateUncached = function(fn, reverse) {
|
|
1219
|
-
var this$1 = this;
|
|
1268
|
+
mappedSequence.__iterateUncached = function (fn, reverse) {
|
|
1269
|
+
var this$1$1 = this;
|
|
1220
1270
|
|
|
1221
1271
|
return collection.__iterate(
|
|
1222
|
-
function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1) !== false; },
|
|
1272
|
+
function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1$1) !== false; },
|
|
1223
1273
|
reverse
|
|
1224
1274
|
);
|
|
1225
1275
|
};
|
|
1226
|
-
mappedSequence.__iteratorUncached = function(type, reverse) {
|
|
1276
|
+
mappedSequence.__iteratorUncached = function (type, reverse) {
|
|
1227
1277
|
var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
|
|
1228
1278
|
return new Iterator(function () {
|
|
1229
1279
|
var step = iterator.next();
|
|
@@ -1244,14 +1294,14 @@ function mapFactory(collection, mapper, context) {
|
|
|
1244
1294
|
}
|
|
1245
1295
|
|
|
1246
1296
|
function reverseFactory(collection, useKeys) {
|
|
1247
|
-
var this$1 = this;
|
|
1297
|
+
var this$1$1 = this;
|
|
1248
1298
|
|
|
1249
1299
|
var reversedSequence = makeSequence(collection);
|
|
1250
1300
|
reversedSequence._iter = collection;
|
|
1251
1301
|
reversedSequence.size = collection.size;
|
|
1252
1302
|
reversedSequence.reverse = function () { return collection; };
|
|
1253
1303
|
if (collection.flip) {
|
|
1254
|
-
reversedSequence.flip = function() {
|
|
1304
|
+
reversedSequence.flip = function () {
|
|
1255
1305
|
var flipSequence = flipFactory(collection);
|
|
1256
1306
|
flipSequence.reverse = function () { return collection.flip(); };
|
|
1257
1307
|
return flipSequence;
|
|
@@ -1261,13 +1311,13 @@ function reverseFactory(collection, useKeys) {
|
|
|
1261
1311
|
reversedSequence.has = function (key) { return collection.has(useKeys ? key : -1 - key); };
|
|
1262
1312
|
reversedSequence.includes = function (value) { return collection.includes(value); };
|
|
1263
1313
|
reversedSequence.cacheResult = cacheResultThrough;
|
|
1264
|
-
reversedSequence.__iterate = function(fn, reverse) {
|
|
1265
|
-
var this$1 = this;
|
|
1314
|
+
reversedSequence.__iterate = function (fn, reverse) {
|
|
1315
|
+
var this$1$1 = this;
|
|
1266
1316
|
|
|
1267
1317
|
var i = 0;
|
|
1268
1318
|
reverse && ensureSize(collection);
|
|
1269
1319
|
return collection.__iterate(
|
|
1270
|
-
function (v, k) { return fn(v, useKeys ? k : reverse ? this$1.size - ++i : i++, this$1); },
|
|
1320
|
+
function (v, k) { return fn(v, useKeys ? k : reverse ? this$1$1.size - ++i : i++, this$1$1); },
|
|
1271
1321
|
!reverse
|
|
1272
1322
|
);
|
|
1273
1323
|
};
|
|
@@ -1283,7 +1333,7 @@ function reverseFactory(collection, useKeys) {
|
|
|
1283
1333
|
var entry = step.value;
|
|
1284
1334
|
return iteratorValue(
|
|
1285
1335
|
type,
|
|
1286
|
-
useKeys ? entry[0] : reverse ? this$1.size - ++i : i++,
|
|
1336
|
+
useKeys ? entry[0] : reverse ? this$1$1.size - ++i : i++,
|
|
1287
1337
|
entry[1],
|
|
1288
1338
|
step
|
|
1289
1339
|
);
|
|
@@ -1306,19 +1356,19 @@ function filterFactory(collection, predicate, context, useKeys) {
|
|
|
1306
1356
|
: notSetValue;
|
|
1307
1357
|
};
|
|
1308
1358
|
}
|
|
1309
|
-
filterSequence.__iterateUncached = function(fn, reverse) {
|
|
1310
|
-
var this$1 = this;
|
|
1359
|
+
filterSequence.__iterateUncached = function (fn, reverse) {
|
|
1360
|
+
var this$1$1 = this;
|
|
1311
1361
|
|
|
1312
1362
|
var iterations = 0;
|
|
1313
1363
|
collection.__iterate(function (v, k, c) {
|
|
1314
1364
|
if (predicate.call(context, v, k, c)) {
|
|
1315
1365
|
iterations++;
|
|
1316
|
-
return fn(v, useKeys ? k : iterations - 1, this$1);
|
|
1366
|
+
return fn(v, useKeys ? k : iterations - 1, this$1$1);
|
|
1317
1367
|
}
|
|
1318
1368
|
}, reverse);
|
|
1319
1369
|
return iterations;
|
|
1320
1370
|
};
|
|
1321
|
-
filterSequence.__iteratorUncached = function(type, reverse) {
|
|
1371
|
+
filterSequence.__iteratorUncached = function (type, reverse) {
|
|
1322
1372
|
var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
|
|
1323
1373
|
var iterations = 0;
|
|
1324
1374
|
return new Iterator(function () {
|
|
@@ -1357,7 +1407,7 @@ function groupByFactory(collection, grouper, context) {
|
|
|
1357
1407
|
);
|
|
1358
1408
|
});
|
|
1359
1409
|
var coerce = collectionClass(collection);
|
|
1360
|
-
return groups.map(function (arr) { return reify(collection, coerce(arr)); });
|
|
1410
|
+
return groups.map(function (arr) { return reify(collection, coerce(arr)); }).asImmutable();
|
|
1361
1411
|
}
|
|
1362
1412
|
|
|
1363
1413
|
function sliceFactory(collection, begin, end, useKeys) {
|
|
@@ -1395,7 +1445,7 @@ function sliceFactory(collection, begin, end, useKeys) {
|
|
|
1395
1445
|
sliceSize === 0 ? sliceSize : (collection.size && sliceSize) || undefined;
|
|
1396
1446
|
|
|
1397
1447
|
if (!useKeys && isSeq(collection) && sliceSize >= 0) {
|
|
1398
|
-
sliceSeq.get = function(index, notSetValue) {
|
|
1448
|
+
sliceSeq.get = function (index, notSetValue) {
|
|
1399
1449
|
index = wrapIndex(this, index);
|
|
1400
1450
|
return index >= 0 && index < sliceSize
|
|
1401
1451
|
? collection.get(index + resolvedBegin, notSetValue)
|
|
@@ -1403,8 +1453,8 @@ function sliceFactory(collection, begin, end, useKeys) {
|
|
|
1403
1453
|
};
|
|
1404
1454
|
}
|
|
1405
1455
|
|
|
1406
|
-
sliceSeq.__iterateUncached = function(fn, reverse) {
|
|
1407
|
-
var this$1 = this;
|
|
1456
|
+
sliceSeq.__iterateUncached = function (fn, reverse) {
|
|
1457
|
+
var this$1$1 = this;
|
|
1408
1458
|
|
|
1409
1459
|
if (sliceSize === 0) {
|
|
1410
1460
|
return 0;
|
|
@@ -1419,7 +1469,7 @@ function sliceFactory(collection, begin, end, useKeys) {
|
|
|
1419
1469
|
if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {
|
|
1420
1470
|
iterations++;
|
|
1421
1471
|
return (
|
|
1422
|
-
fn(v, useKeys ? k : iterations - 1, this$1) !== false &&
|
|
1472
|
+
fn(v, useKeys ? k : iterations - 1, this$1$1) !== false &&
|
|
1423
1473
|
iterations !== sliceSize
|
|
1424
1474
|
);
|
|
1425
1475
|
}
|
|
@@ -1427,7 +1477,7 @@ function sliceFactory(collection, begin, end, useKeys) {
|
|
|
1427
1477
|
return iterations;
|
|
1428
1478
|
};
|
|
1429
1479
|
|
|
1430
|
-
sliceSeq.__iteratorUncached = function(type, reverse) {
|
|
1480
|
+
sliceSeq.__iteratorUncached = function (type, reverse) {
|
|
1431
1481
|
if (sliceSize !== 0 && reverse) {
|
|
1432
1482
|
return this.cacheResult().__iterator(type, reverse);
|
|
1433
1483
|
}
|
|
@@ -1461,20 +1511,20 @@ function sliceFactory(collection, begin, end, useKeys) {
|
|
|
1461
1511
|
|
|
1462
1512
|
function takeWhileFactory(collection, predicate, context) {
|
|
1463
1513
|
var takeSequence = makeSequence(collection);
|
|
1464
|
-
takeSequence.__iterateUncached = function(fn, reverse) {
|
|
1465
|
-
var this$1 = this;
|
|
1514
|
+
takeSequence.__iterateUncached = function (fn, reverse) {
|
|
1515
|
+
var this$1$1 = this;
|
|
1466
1516
|
|
|
1467
1517
|
if (reverse) {
|
|
1468
1518
|
return this.cacheResult().__iterate(fn, reverse);
|
|
1469
1519
|
}
|
|
1470
1520
|
var iterations = 0;
|
|
1471
1521
|
collection.__iterate(
|
|
1472
|
-
function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1); }
|
|
1522
|
+
function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1$1); }
|
|
1473
1523
|
);
|
|
1474
1524
|
return iterations;
|
|
1475
1525
|
};
|
|
1476
|
-
takeSequence.__iteratorUncached = function(type, reverse) {
|
|
1477
|
-
var this$1 = this;
|
|
1526
|
+
takeSequence.__iteratorUncached = function (type, reverse) {
|
|
1527
|
+
var this$1$1 = this;
|
|
1478
1528
|
|
|
1479
1529
|
if (reverse) {
|
|
1480
1530
|
return this.cacheResult().__iterator(type, reverse);
|
|
@@ -1492,7 +1542,7 @@ function takeWhileFactory(collection, predicate, context) {
|
|
|
1492
1542
|
var entry = step.value;
|
|
1493
1543
|
var k = entry[0];
|
|
1494
1544
|
var v = entry[1];
|
|
1495
|
-
if (!predicate.call(context, v, k, this$1)) {
|
|
1545
|
+
if (!predicate.call(context, v, k, this$1$1)) {
|
|
1496
1546
|
iterating = false;
|
|
1497
1547
|
return iteratorDone();
|
|
1498
1548
|
}
|
|
@@ -1504,8 +1554,8 @@ function takeWhileFactory(collection, predicate, context) {
|
|
|
1504
1554
|
|
|
1505
1555
|
function skipWhileFactory(collection, predicate, context, useKeys) {
|
|
1506
1556
|
var skipSequence = makeSequence(collection);
|
|
1507
|
-
skipSequence.__iterateUncached = function(fn, reverse) {
|
|
1508
|
-
var this$1 = this;
|
|
1557
|
+
skipSequence.__iterateUncached = function (fn, reverse) {
|
|
1558
|
+
var this$1$1 = this;
|
|
1509
1559
|
|
|
1510
1560
|
if (reverse) {
|
|
1511
1561
|
return this.cacheResult().__iterate(fn, reverse);
|
|
@@ -1515,13 +1565,13 @@ function skipWhileFactory(collection, predicate, context, useKeys) {
|
|
|
1515
1565
|
collection.__iterate(function (v, k, c) {
|
|
1516
1566
|
if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {
|
|
1517
1567
|
iterations++;
|
|
1518
|
-
return fn(v, useKeys ? k : iterations - 1, this$1);
|
|
1568
|
+
return fn(v, useKeys ? k : iterations - 1, this$1$1);
|
|
1519
1569
|
}
|
|
1520
1570
|
});
|
|
1521
1571
|
return iterations;
|
|
1522
1572
|
};
|
|
1523
|
-
skipSequence.__iteratorUncached = function(type, reverse) {
|
|
1524
|
-
var this$1 = this;
|
|
1573
|
+
skipSequence.__iteratorUncached = function (type, reverse) {
|
|
1574
|
+
var this$1$1 = this;
|
|
1525
1575
|
|
|
1526
1576
|
if (reverse) {
|
|
1527
1577
|
return this.cacheResult().__iterator(type, reverse);
|
|
@@ -1547,7 +1597,7 @@ function skipWhileFactory(collection, predicate, context, useKeys) {
|
|
|
1547
1597
|
var entry = step.value;
|
|
1548
1598
|
k = entry[0];
|
|
1549
1599
|
v = entry[1];
|
|
1550
|
-
skipping && (skipping = predicate.call(context, v, k, this$1));
|
|
1600
|
+
skipping && (skipping = predicate.call(context, v, k, this$1$1));
|
|
1551
1601
|
} while (skipping);
|
|
1552
1602
|
return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
|
|
1553
1603
|
});
|
|
@@ -1606,7 +1656,7 @@ function concatFactory(collection, values) {
|
|
|
1606
1656
|
|
|
1607
1657
|
function flattenFactory(collection, depth, useKeys) {
|
|
1608
1658
|
var flatSequence = makeSequence(collection);
|
|
1609
|
-
flatSequence.__iterateUncached = function(fn, reverse) {
|
|
1659
|
+
flatSequence.__iterateUncached = function (fn, reverse) {
|
|
1610
1660
|
if (reverse) {
|
|
1611
1661
|
return this.cacheResult().__iterate(fn, reverse);
|
|
1612
1662
|
}
|
|
@@ -1628,7 +1678,7 @@ function flattenFactory(collection, depth, useKeys) {
|
|
|
1628
1678
|
flatDeep(collection, 0);
|
|
1629
1679
|
return iterations;
|
|
1630
1680
|
};
|
|
1631
|
-
flatSequence.__iteratorUncached = function(type, reverse) {
|
|
1681
|
+
flatSequence.__iteratorUncached = function (type, reverse) {
|
|
1632
1682
|
if (reverse) {
|
|
1633
1683
|
return this.cacheResult().__iterator(type, reverse);
|
|
1634
1684
|
}
|
|
@@ -1670,18 +1720,18 @@ function flatMapFactory(collection, mapper, context) {
|
|
|
1670
1720
|
function interposeFactory(collection, separator) {
|
|
1671
1721
|
var interposedSequence = makeSequence(collection);
|
|
1672
1722
|
interposedSequence.size = collection.size && collection.size * 2 - 1;
|
|
1673
|
-
interposedSequence.__iterateUncached = function(fn, reverse) {
|
|
1674
|
-
var this$1 = this;
|
|
1723
|
+
interposedSequence.__iterateUncached = function (fn, reverse) {
|
|
1724
|
+
var this$1$1 = this;
|
|
1675
1725
|
|
|
1676
1726
|
var iterations = 0;
|
|
1677
1727
|
collection.__iterate(
|
|
1678
|
-
function (v) { return (!iterations || fn(separator, iterations++, this$1) !== false) &&
|
|
1679
|
-
fn(v, iterations++, this$1) !== false; },
|
|
1728
|
+
function (v) { return (!iterations || fn(separator, iterations++, this$1$1) !== false) &&
|
|
1729
|
+
fn(v, iterations++, this$1$1) !== false; },
|
|
1680
1730
|
reverse
|
|
1681
1731
|
);
|
|
1682
1732
|
return iterations;
|
|
1683
1733
|
};
|
|
1684
|
-
interposedSequence.__iteratorUncached = function(type, reverse) {
|
|
1734
|
+
interposedSequence.__iteratorUncached = function (type, reverse) {
|
|
1685
1735
|
var iterator = collection.__iterator(ITERATE_VALUES, reverse);
|
|
1686
1736
|
var iterations = 0;
|
|
1687
1737
|
var step;
|
|
@@ -1711,18 +1761,22 @@ function sortFactory(collection, comparator, mapper) {
|
|
|
1711
1761
|
.map(function (v, k) { return [k, v, index++, mapper ? mapper(v, k, collection) : v]; })
|
|
1712
1762
|
.valueSeq()
|
|
1713
1763
|
.toArray();
|
|
1714
|
-
entries
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1764
|
+
entries
|
|
1765
|
+
.sort(function (a, b) { return comparator(a[3], b[3]) || a[2] - b[2]; })
|
|
1766
|
+
.forEach(
|
|
1767
|
+
isKeyedCollection
|
|
1768
|
+
? function (v, i) {
|
|
1769
|
+
entries[i].length = 2;
|
|
1770
|
+
}
|
|
1771
|
+
: function (v, i) {
|
|
1772
|
+
entries[i] = v[1];
|
|
1773
|
+
}
|
|
1774
|
+
);
|
|
1723
1775
|
return isKeyedCollection
|
|
1724
1776
|
? KeyedSeq(entries)
|
|
1725
|
-
: isIndexed(collection)
|
|
1777
|
+
: isIndexed(collection)
|
|
1778
|
+
? IndexedSeq(entries)
|
|
1779
|
+
: SetSeq(entries);
|
|
1726
1780
|
}
|
|
1727
1781
|
|
|
1728
1782
|
function maxFactory(collection, comparator, mapper) {
|
|
@@ -1755,9 +1809,7 @@ function zipWithFactory(keyIter, zipper, iters, zipAll) {
|
|
|
1755
1809
|
zipSequence.size = zipAll ? sizes.max() : sizes.min();
|
|
1756
1810
|
// Note: this a generic base implementation of __iterate in terms of
|
|
1757
1811
|
// __iterator which may be more generically useful in the future.
|
|
1758
|
-
zipSequence.__iterate = function(fn, reverse) {
|
|
1759
|
-
var this$1 = this;
|
|
1760
|
-
|
|
1812
|
+
zipSequence.__iterate = function (fn, reverse) {
|
|
1761
1813
|
/* generic:
|
|
1762
1814
|
var iterator = this.__iterator(ITERATE_ENTRIES, reverse);
|
|
1763
1815
|
var step;
|
|
@@ -1775,13 +1827,13 @@ function zipWithFactory(keyIter, zipper, iters, zipAll) {
|
|
|
1775
1827
|
var step;
|
|
1776
1828
|
var iterations = 0;
|
|
1777
1829
|
while (!(step = iterator.next()).done) {
|
|
1778
|
-
if (fn(step.value, iterations++, this
|
|
1830
|
+
if (fn(step.value, iterations++, this) === false) {
|
|
1779
1831
|
break;
|
|
1780
1832
|
}
|
|
1781
1833
|
}
|
|
1782
1834
|
return iterations;
|
|
1783
1835
|
};
|
|
1784
|
-
zipSequence.__iteratorUncached = function(type, reverse) {
|
|
1836
|
+
zipSequence.__iteratorUncached = function (type, reverse) {
|
|
1785
1837
|
var iterators = iters.map(
|
|
1786
1838
|
function (i) { return ((i = Collection(i)), getIterator(reverse ? i.reverse() : i)); }
|
|
1787
1839
|
);
|
|
@@ -1799,7 +1851,10 @@ function zipWithFactory(keyIter, zipper, iters, zipAll) {
|
|
|
1799
1851
|
return iteratorValue(
|
|
1800
1852
|
type,
|
|
1801
1853
|
iterations++,
|
|
1802
|
-
zipper.apply(
|
|
1854
|
+
zipper.apply(
|
|
1855
|
+
null,
|
|
1856
|
+
steps.map(function (s) { return s.value; })
|
|
1857
|
+
)
|
|
1803
1858
|
);
|
|
1804
1859
|
});
|
|
1805
1860
|
};
|
|
@@ -1821,14 +1876,18 @@ function validateEntry(entry) {
|
|
|
1821
1876
|
function collectionClass(collection) {
|
|
1822
1877
|
return isKeyed(collection)
|
|
1823
1878
|
? KeyedCollection
|
|
1824
|
-
: isIndexed(collection)
|
|
1879
|
+
: isIndexed(collection)
|
|
1880
|
+
? IndexedCollection
|
|
1881
|
+
: SetCollection;
|
|
1825
1882
|
}
|
|
1826
1883
|
|
|
1827
1884
|
function makeSequence(collection) {
|
|
1828
1885
|
return Object.create(
|
|
1829
1886
|
(isKeyed(collection)
|
|
1830
1887
|
? KeyedSeq
|
|
1831
|
-
: isIndexed(collection)
|
|
1888
|
+
: isIndexed(collection)
|
|
1889
|
+
? IndexedSeq
|
|
1890
|
+
: SetSeq
|
|
1832
1891
|
).prototype
|
|
1833
1892
|
);
|
|
1834
1893
|
}
|
|
@@ -1858,7 +1917,6 @@ function defaultComparator(a, b) {
|
|
|
1858
1917
|
return a > b ? 1 : a < b ? -1 : 0;
|
|
1859
1918
|
}
|
|
1860
1919
|
|
|
1861
|
-
// http://jsperf.com/copy-array-inline
|
|
1862
1920
|
function arrCopy(arr, offset) {
|
|
1863
1921
|
offset = offset || 0;
|
|
1864
1922
|
var len = Math.max(0, arr.length - offset);
|
|
@@ -1892,10 +1950,31 @@ function coerceKeyPath(keyPath) {
|
|
|
1892
1950
|
);
|
|
1893
1951
|
}
|
|
1894
1952
|
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1953
|
+
var toString = Object.prototype.toString;
|
|
1954
|
+
|
|
1955
|
+
function isPlainObject(value) {
|
|
1956
|
+
// The base prototype's toString deals with Argument objects and native namespaces like Math
|
|
1957
|
+
if (
|
|
1958
|
+
!value ||
|
|
1959
|
+
typeof value !== 'object' ||
|
|
1960
|
+
toString.call(value) !== '[object Object]'
|
|
1961
|
+
) {
|
|
1962
|
+
return false;
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
var proto = Object.getPrototypeOf(value);
|
|
1966
|
+
if (proto === null) {
|
|
1967
|
+
return true;
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
// Iteratively going up the prototype chain is needed for cross-realm environments (differing contexts, iframes, etc)
|
|
1971
|
+
var parentProto = proto;
|
|
1972
|
+
var nextProto = Object.getPrototypeOf(proto);
|
|
1973
|
+
while (nextProto !== null) {
|
|
1974
|
+
parentProto = nextProto;
|
|
1975
|
+
nextProto = Object.getPrototypeOf(parentProto);
|
|
1976
|
+
}
|
|
1977
|
+
return parentProto === proto;
|
|
1899
1978
|
}
|
|
1900
1979
|
|
|
1901
1980
|
/**
|
|
@@ -1903,12 +1982,12 @@ function isPlainObj(value) {
|
|
|
1903
1982
|
* provided by Immutable.js or a plain Array or Object.
|
|
1904
1983
|
*/
|
|
1905
1984
|
function isDataStructure(value) {
|
|
1906
|
-
return
|
|
1985
|
+
return (
|
|
1986
|
+
typeof value === 'object' &&
|
|
1987
|
+
(isImmutable(value) || Array.isArray(value) || isPlainObject(value))
|
|
1988
|
+
);
|
|
1907
1989
|
}
|
|
1908
1990
|
|
|
1909
|
-
/**
|
|
1910
|
-
* Converts a value to a string, adding quotes if a string was provided.
|
|
1911
|
-
*/
|
|
1912
1991
|
function quoteString(value) {
|
|
1913
1992
|
try {
|
|
1914
1993
|
return typeof value === 'string' ? JSON.stringify(value) : String(value);
|
|
@@ -1927,10 +2006,10 @@ function get(collection, key, notSetValue) {
|
|
|
1927
2006
|
return isImmutable(collection)
|
|
1928
2007
|
? collection.get(key, notSetValue)
|
|
1929
2008
|
: !has(collection, key)
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
2009
|
+
? notSetValue
|
|
2010
|
+
: typeof collection.get === 'function'
|
|
2011
|
+
? collection.get(key)
|
|
2012
|
+
: collection[key];
|
|
1934
2013
|
}
|
|
1935
2014
|
|
|
1936
2015
|
function shallowCopy(from) {
|
|
@@ -1994,7 +2073,7 @@ function set(collection, key, value) {
|
|
|
1994
2073
|
return collectionCopy;
|
|
1995
2074
|
}
|
|
1996
2075
|
|
|
1997
|
-
function updateIn(collection, keyPath, notSetValue, updater) {
|
|
2076
|
+
function updateIn$1(collection, keyPath, notSetValue, updater) {
|
|
1998
2077
|
if (!updater) {
|
|
1999
2078
|
updater = notSetValue;
|
|
2000
2079
|
notSetValue = undefined;
|
|
@@ -2045,24 +2124,24 @@ function updateInDeeply(
|
|
|
2045
2124
|
return nextUpdated === nextExisting
|
|
2046
2125
|
? existing
|
|
2047
2126
|
: nextUpdated === NOT_SET
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2127
|
+
? remove(existing, key)
|
|
2128
|
+
: set(
|
|
2129
|
+
wasNotSet ? (inImmutable ? emptyMap() : {}) : existing,
|
|
2130
|
+
key,
|
|
2131
|
+
nextUpdated
|
|
2132
|
+
);
|
|
2054
2133
|
}
|
|
2055
2134
|
|
|
2056
2135
|
function setIn$1(collection, keyPath, value) {
|
|
2057
|
-
return updateIn(collection, keyPath, NOT_SET, function () { return value; });
|
|
2136
|
+
return updateIn$1(collection, keyPath, NOT_SET, function () { return value; });
|
|
2058
2137
|
}
|
|
2059
2138
|
|
|
2060
|
-
function setIn
|
|
2139
|
+
function setIn(keyPath, v) {
|
|
2061
2140
|
return setIn$1(this, keyPath, v);
|
|
2062
2141
|
}
|
|
2063
2142
|
|
|
2064
2143
|
function removeIn(collection, keyPath) {
|
|
2065
|
-
return updateIn(collection, keyPath, function () { return NOT_SET; });
|
|
2144
|
+
return updateIn$1(collection, keyPath, function () { return NOT_SET; });
|
|
2066
2145
|
}
|
|
2067
2146
|
|
|
2068
2147
|
function deleteIn(keyPath) {
|
|
@@ -2070,30 +2149,33 @@ function deleteIn(keyPath) {
|
|
|
2070
2149
|
}
|
|
2071
2150
|
|
|
2072
2151
|
function update$1(collection, key, notSetValue, updater) {
|
|
2073
|
-
return updateIn(collection, [key], notSetValue, updater);
|
|
2152
|
+
return updateIn$1(collection, [key], notSetValue, updater);
|
|
2074
2153
|
}
|
|
2075
2154
|
|
|
2076
|
-
function update
|
|
2155
|
+
function update(key, notSetValue, updater) {
|
|
2077
2156
|
return arguments.length === 1
|
|
2078
2157
|
? key(this)
|
|
2079
2158
|
: update$1(this, key, notSetValue, updater);
|
|
2080
2159
|
}
|
|
2081
2160
|
|
|
2082
|
-
function updateIn
|
|
2083
|
-
return updateIn(this, keyPath, notSetValue, updater);
|
|
2161
|
+
function updateIn(keyPath, notSetValue, updater) {
|
|
2162
|
+
return updateIn$1(this, keyPath, notSetValue, updater);
|
|
2084
2163
|
}
|
|
2085
2164
|
|
|
2086
|
-
function merge() {
|
|
2165
|
+
function merge$1() {
|
|
2087
2166
|
var iters = [], len = arguments.length;
|
|
2088
2167
|
while ( len-- ) iters[ len ] = arguments[ len ];
|
|
2089
2168
|
|
|
2090
2169
|
return mergeIntoKeyedWith(this, iters);
|
|
2091
2170
|
}
|
|
2092
2171
|
|
|
2093
|
-
function mergeWith(merger) {
|
|
2172
|
+
function mergeWith$1(merger) {
|
|
2094
2173
|
var iters = [], len = arguments.length - 1;
|
|
2095
2174
|
while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
|
|
2096
2175
|
|
|
2176
|
+
if (typeof merger !== 'function') {
|
|
2177
|
+
throw new TypeError('Invalid merger function: ' + merger);
|
|
2178
|
+
}
|
|
2097
2179
|
return mergeIntoKeyedWith(this, iters, merger);
|
|
2098
2180
|
}
|
|
2099
2181
|
|
|
@@ -2108,17 +2190,17 @@ function mergeIntoKeyedWith(collection, collections, merger) {
|
|
|
2108
2190
|
if (iters.length === 0) {
|
|
2109
2191
|
return collection;
|
|
2110
2192
|
}
|
|
2111
|
-
if (
|
|
2193
|
+
if (
|
|
2194
|
+
collection.toSeq().size === 0 &&
|
|
2195
|
+
!collection.__ownerID &&
|
|
2196
|
+
iters.length === 1
|
|
2197
|
+
) {
|
|
2112
2198
|
return collection.constructor(iters[0]);
|
|
2113
2199
|
}
|
|
2114
2200
|
return collection.withMutations(function (collection) {
|
|
2115
2201
|
var mergeIntoCollection = merger
|
|
2116
2202
|
? function (value, key) {
|
|
2117
|
-
update$1(
|
|
2118
|
-
collection,
|
|
2119
|
-
key,
|
|
2120
|
-
NOT_SET,
|
|
2121
|
-
function (oldVal) { return (oldVal === NOT_SET ? value : merger(oldVal, value, key)); }
|
|
2203
|
+
update$1(collection, key, NOT_SET, function (oldVal) { return oldVal === NOT_SET ? value : merger(oldVal, value, key); }
|
|
2122
2204
|
);
|
|
2123
2205
|
}
|
|
2124
2206
|
: function (value, key) {
|
|
@@ -2130,14 +2212,14 @@ function mergeIntoKeyedWith(collection, collections, merger) {
|
|
|
2130
2212
|
});
|
|
2131
2213
|
}
|
|
2132
2214
|
|
|
2133
|
-
function merge
|
|
2215
|
+
function merge(collection) {
|
|
2134
2216
|
var sources = [], len = arguments.length - 1;
|
|
2135
2217
|
while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
|
|
2136
2218
|
|
|
2137
2219
|
return mergeWithSources(collection, sources);
|
|
2138
2220
|
}
|
|
2139
2221
|
|
|
2140
|
-
function mergeWith
|
|
2222
|
+
function mergeWith(merger, collection) {
|
|
2141
2223
|
var sources = [], len = arguments.length - 2;
|
|
2142
2224
|
while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
|
|
2143
2225
|
|
|
@@ -2169,13 +2251,15 @@ function mergeWithSources(collection, sources, merger) {
|
|
|
2169
2251
|
);
|
|
2170
2252
|
}
|
|
2171
2253
|
if (isImmutable(collection)) {
|
|
2172
|
-
return collection.mergeWith
|
|
2254
|
+
return typeof merger === 'function' && collection.mergeWith
|
|
2173
2255
|
? collection.mergeWith.apply(collection, [ merger ].concat( sources ))
|
|
2256
|
+
: collection.merge
|
|
2257
|
+
? collection.merge.apply(collection, sources)
|
|
2174
2258
|
: collection.concat.apply(collection, sources);
|
|
2175
2259
|
}
|
|
2176
2260
|
var isArray = Array.isArray(collection);
|
|
2177
2261
|
var merged = collection;
|
|
2178
|
-
var Collection
|
|
2262
|
+
var Collection = isArray ? IndexedCollection : KeyedCollection;
|
|
2179
2263
|
var mergeItem = isArray
|
|
2180
2264
|
? function (value) {
|
|
2181
2265
|
// Copy on write
|
|
@@ -2197,20 +2281,40 @@ function mergeWithSources(collection, sources, merger) {
|
|
|
2197
2281
|
}
|
|
2198
2282
|
};
|
|
2199
2283
|
for (var i = 0; i < sources.length; i++) {
|
|
2200
|
-
Collection
|
|
2284
|
+
Collection(sources[i]).forEach(mergeItem);
|
|
2201
2285
|
}
|
|
2202
2286
|
return merged;
|
|
2203
2287
|
}
|
|
2204
2288
|
|
|
2205
2289
|
function deepMergerWith(merger) {
|
|
2206
2290
|
function deepMerger(oldValue, newValue, key) {
|
|
2207
|
-
return isDataStructure(oldValue) &&
|
|
2291
|
+
return isDataStructure(oldValue) &&
|
|
2292
|
+
isDataStructure(newValue) &&
|
|
2293
|
+
areMergeable(oldValue, newValue)
|
|
2208
2294
|
? mergeWithSources(oldValue, [newValue], deepMerger)
|
|
2209
|
-
: merger
|
|
2295
|
+
: merger
|
|
2296
|
+
? merger(oldValue, newValue, key)
|
|
2297
|
+
: newValue;
|
|
2210
2298
|
}
|
|
2211
2299
|
return deepMerger;
|
|
2212
2300
|
}
|
|
2213
2301
|
|
|
2302
|
+
/**
|
|
2303
|
+
* It's unclear what the desired behavior is for merging two collections that
|
|
2304
|
+
* fall into separate categories between keyed, indexed, or set-like, so we only
|
|
2305
|
+
* consider them mergeable if they fall into the same category.
|
|
2306
|
+
*/
|
|
2307
|
+
function areMergeable(oldDataStructure, newDataStructure) {
|
|
2308
|
+
var oldSeq = Seq(oldDataStructure);
|
|
2309
|
+
var newSeq = Seq(newDataStructure);
|
|
2310
|
+
// This logic assumes that a sequence can only fall into one of the three
|
|
2311
|
+
// categories mentioned above (since there's no `isSetLike()` method).
|
|
2312
|
+
return (
|
|
2313
|
+
isIndexed(oldSeq) === isIndexed(newSeq) &&
|
|
2314
|
+
isKeyed(oldSeq) === isKeyed(newSeq)
|
|
2315
|
+
);
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2214
2318
|
function mergeDeep() {
|
|
2215
2319
|
var iters = [], len = arguments.length;
|
|
2216
2320
|
while ( len-- ) iters[ len ] = arguments[ len ];
|
|
@@ -2229,14 +2333,14 @@ function mergeIn(keyPath) {
|
|
|
2229
2333
|
var iters = [], len = arguments.length - 1;
|
|
2230
2334
|
while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
|
|
2231
2335
|
|
|
2232
|
-
return updateIn(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
|
|
2336
|
+
return updateIn$1(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
|
|
2233
2337
|
}
|
|
2234
2338
|
|
|
2235
2339
|
function mergeDeepIn(keyPath) {
|
|
2236
2340
|
var iters = [], len = arguments.length - 1;
|
|
2237
2341
|
while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
|
|
2238
2342
|
|
|
2239
|
-
return updateIn(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
|
|
2343
|
+
return updateIn$1(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
|
|
2240
2344
|
);
|
|
2241
2345
|
}
|
|
2242
2346
|
|
|
@@ -2258,21 +2362,21 @@ function wasAltered() {
|
|
|
2258
2362
|
return this.__altered;
|
|
2259
2363
|
}
|
|
2260
2364
|
|
|
2261
|
-
var Map = (function (KeyedCollection
|
|
2365
|
+
var Map = /*@__PURE__*/(function (KeyedCollection) {
|
|
2262
2366
|
function Map(value) {
|
|
2263
|
-
return value ===
|
|
2367
|
+
return value === undefined || value === null
|
|
2264
2368
|
? emptyMap()
|
|
2265
2369
|
: isMap(value) && !isOrdered(value)
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2370
|
+
? value
|
|
2371
|
+
: emptyMap().withMutations(function (map) {
|
|
2372
|
+
var iter = KeyedCollection(value);
|
|
2373
|
+
assertNotInfinite(iter.size);
|
|
2374
|
+
iter.forEach(function (v, k) { return map.set(k, v); });
|
|
2375
|
+
});
|
|
2272
2376
|
}
|
|
2273
2377
|
|
|
2274
|
-
if ( KeyedCollection
|
|
2275
|
-
Map.prototype = Object.create( KeyedCollection
|
|
2378
|
+
if ( KeyedCollection ) Map.__proto__ = KeyedCollection;
|
|
2379
|
+
Map.prototype = Object.create( KeyedCollection && KeyedCollection.prototype );
|
|
2276
2380
|
Map.prototype.constructor = Map;
|
|
2277
2381
|
|
|
2278
2382
|
Map.of = function of () {
|
|
@@ -2349,6 +2453,16 @@ var Map = (function (KeyedCollection$$1) {
|
|
|
2349
2453
|
return OrderedMap(sortFactory(this, comparator, mapper));
|
|
2350
2454
|
};
|
|
2351
2455
|
|
|
2456
|
+
Map.prototype.map = function map (mapper, context) {
|
|
2457
|
+
var this$1$1 = this;
|
|
2458
|
+
|
|
2459
|
+
return this.withMutations(function (map) {
|
|
2460
|
+
map.forEach(function (value, key) {
|
|
2461
|
+
map.set(key, mapper.call(context, value, key, this$1$1));
|
|
2462
|
+
});
|
|
2463
|
+
});
|
|
2464
|
+
};
|
|
2465
|
+
|
|
2352
2466
|
// @pragma Mutability
|
|
2353
2467
|
|
|
2354
2468
|
Map.prototype.__iterator = function __iterator (type, reverse) {
|
|
@@ -2356,13 +2470,13 @@ var Map = (function (KeyedCollection$$1) {
|
|
|
2356
2470
|
};
|
|
2357
2471
|
|
|
2358
2472
|
Map.prototype.__iterate = function __iterate (fn, reverse) {
|
|
2359
|
-
var this$1 = this;
|
|
2473
|
+
var this$1$1 = this;
|
|
2360
2474
|
|
|
2361
2475
|
var iterations = 0;
|
|
2362
2476
|
this._root &&
|
|
2363
2477
|
this._root.iterate(function (entry) {
|
|
2364
2478
|
iterations++;
|
|
2365
|
-
return fn(entry[1], entry[0], this$1);
|
|
2479
|
+
return fn(entry[1], entry[0], this$1$1);
|
|
2366
2480
|
}, reverse);
|
|
2367
2481
|
return iterations;
|
|
2368
2482
|
};
|
|
@@ -2385,25 +2499,18 @@ var Map = (function (KeyedCollection$$1) {
|
|
|
2385
2499
|
return Map;
|
|
2386
2500
|
}(KeyedCollection));
|
|
2387
2501
|
|
|
2388
|
-
function isMap(maybeMap) {
|
|
2389
|
-
return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]);
|
|
2390
|
-
}
|
|
2391
|
-
|
|
2392
2502
|
Map.isMap = isMap;
|
|
2393
2503
|
|
|
2394
|
-
var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
|
|
2395
|
-
|
|
2396
2504
|
var MapPrototype = Map.prototype;
|
|
2397
|
-
MapPrototype[
|
|
2505
|
+
MapPrototype[IS_MAP_SYMBOL] = true;
|
|
2398
2506
|
MapPrototype[DELETE] = MapPrototype.remove;
|
|
2399
2507
|
MapPrototype.removeAll = MapPrototype.deleteAll;
|
|
2400
|
-
MapPrototype.
|
|
2401
|
-
MapPrototype.setIn = setIn$$1;
|
|
2508
|
+
MapPrototype.setIn = setIn;
|
|
2402
2509
|
MapPrototype.removeIn = MapPrototype.deleteIn = deleteIn;
|
|
2403
|
-
MapPrototype.update = update
|
|
2404
|
-
MapPrototype.updateIn = updateIn
|
|
2405
|
-
MapPrototype.merge = merge;
|
|
2406
|
-
MapPrototype.mergeWith = mergeWith;
|
|
2510
|
+
MapPrototype.update = update;
|
|
2511
|
+
MapPrototype.updateIn = updateIn;
|
|
2512
|
+
MapPrototype.merge = MapPrototype.concat = merge$1;
|
|
2513
|
+
MapPrototype.mergeWith = mergeWith$1;
|
|
2407
2514
|
MapPrototype.mergeDeep = mergeDeep;
|
|
2408
2515
|
MapPrototype.mergeDeepWith = mergeDeepWith;
|
|
2409
2516
|
MapPrototype.mergeIn = mergeIn;
|
|
@@ -2412,10 +2519,10 @@ MapPrototype.withMutations = withMutations;
|
|
|
2412
2519
|
MapPrototype.wasAltered = wasAltered;
|
|
2413
2520
|
MapPrototype.asImmutable = asImmutable;
|
|
2414
2521
|
MapPrototype['@@transducer/init'] = MapPrototype.asMutable = asMutable;
|
|
2415
|
-
MapPrototype['@@transducer/step'] = function(result, arr) {
|
|
2522
|
+
MapPrototype['@@transducer/step'] = function (result, arr) {
|
|
2416
2523
|
return result.set(arr[0], arr[1]);
|
|
2417
2524
|
};
|
|
2418
|
-
MapPrototype['@@transducer/result'] = function(obj) {
|
|
2525
|
+
MapPrototype['@@transducer/result'] = function (obj) {
|
|
2419
2526
|
return obj.asImmutable();
|
|
2420
2527
|
};
|
|
2421
2528
|
|
|
@@ -2436,7 +2543,7 @@ ArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
|
|
|
2436
2543
|
return notSetValue;
|
|
2437
2544
|
};
|
|
2438
2545
|
|
|
2439
|
-
ArrayMapNode.prototype.update = function update
|
|
2546
|
+
ArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
|
|
2440
2547
|
var removed = value === NOT_SET;
|
|
2441
2548
|
|
|
2442
2549
|
var entries = this.entries;
|
|
@@ -2509,7 +2616,7 @@ BitmapIndexedNode.prototype.get = function get (shift, keyHash, key, notSetValue
|
|
|
2509
2616
|
);
|
|
2510
2617
|
};
|
|
2511
2618
|
|
|
2512
|
-
BitmapIndexedNode.prototype.update = function update
|
|
2619
|
+
BitmapIndexedNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
|
|
2513
2620
|
if (keyHash === undefined) {
|
|
2514
2621
|
keyHash = hash(key);
|
|
2515
2622
|
}
|
|
@@ -2591,7 +2698,7 @@ HashArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue)
|
|
|
2591
2698
|
: notSetValue;
|
|
2592
2699
|
};
|
|
2593
2700
|
|
|
2594
|
-
HashArrayMapNode.prototype.update = function update
|
|
2701
|
+
HashArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
|
|
2595
2702
|
if (keyHash === undefined) {
|
|
2596
2703
|
keyHash = hash(key);
|
|
2597
2704
|
}
|
|
@@ -2656,7 +2763,7 @@ HashCollisionNode.prototype.get = function get (shift, keyHash, key, notSetValue
|
|
|
2656
2763
|
return notSetValue;
|
|
2657
2764
|
};
|
|
2658
2765
|
|
|
2659
|
-
HashCollisionNode.prototype.update = function update
|
|
2766
|
+
HashCollisionNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
|
|
2660
2767
|
if (keyHash === undefined) {
|
|
2661
2768
|
keyHash = hash(key);
|
|
2662
2769
|
}
|
|
@@ -2726,7 +2833,7 @@ ValueNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
|
|
|
2726
2833
|
return is(key, this.entry[0]) ? this.entry[1] : notSetValue;
|
|
2727
2834
|
};
|
|
2728
2835
|
|
|
2729
|
-
ValueNode.prototype.update = function update
|
|
2836
|
+
ValueNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
|
|
2730
2837
|
var removed = value === NOT_SET;
|
|
2731
2838
|
var keyMatch = is(key, this.entry[0]);
|
|
2732
2839
|
if (keyMatch ? value === this.entry[1] : removed) {
|
|
@@ -2754,50 +2861,44 @@ ValueNode.prototype.update = function update$$1 (ownerID, shift, keyHash, key, v
|
|
|
2754
2861
|
|
|
2755
2862
|
// #pragma Iterators
|
|
2756
2863
|
|
|
2757
|
-
ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate =
|
|
2758
|
-
fn,
|
|
2759
|
-
|
|
2760
|
-
) {
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
return false;
|
|
2864
|
+
ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate =
|
|
2865
|
+
function (fn, reverse) {
|
|
2866
|
+
var entries = this.entries;
|
|
2867
|
+
for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
|
|
2868
|
+
if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
|
|
2869
|
+
return false;
|
|
2870
|
+
}
|
|
2765
2871
|
}
|
|
2766
|
-
}
|
|
2767
|
-
};
|
|
2872
|
+
};
|
|
2768
2873
|
|
|
2769
|
-
BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate =
|
|
2770
|
-
fn,
|
|
2771
|
-
|
|
2772
|
-
) {
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
return false;
|
|
2874
|
+
BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate =
|
|
2875
|
+
function (fn, reverse) {
|
|
2876
|
+
var nodes = this.nodes;
|
|
2877
|
+
for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
|
|
2878
|
+
var node = nodes[reverse ? maxIndex - ii : ii];
|
|
2879
|
+
if (node && node.iterate(fn, reverse) === false) {
|
|
2880
|
+
return false;
|
|
2881
|
+
}
|
|
2778
2882
|
}
|
|
2779
|
-
}
|
|
2780
|
-
};
|
|
2883
|
+
};
|
|
2781
2884
|
|
|
2782
2885
|
// eslint-disable-next-line no-unused-vars
|
|
2783
|
-
ValueNode.prototype.iterate = function(fn, reverse) {
|
|
2886
|
+
ValueNode.prototype.iterate = function (fn, reverse) {
|
|
2784
2887
|
return fn(this.entry);
|
|
2785
2888
|
};
|
|
2786
2889
|
|
|
2787
|
-
var MapIterator = (function (Iterator
|
|
2890
|
+
var MapIterator = /*@__PURE__*/(function (Iterator) {
|
|
2788
2891
|
function MapIterator(map, type, reverse) {
|
|
2789
2892
|
this._type = type;
|
|
2790
2893
|
this._reverse = reverse;
|
|
2791
2894
|
this._stack = map._root && mapIteratorFrame(map._root);
|
|
2792
2895
|
}
|
|
2793
2896
|
|
|
2794
|
-
if ( Iterator
|
|
2795
|
-
MapIterator.prototype = Object.create( Iterator
|
|
2897
|
+
if ( Iterator ) MapIterator.__proto__ = Iterator;
|
|
2898
|
+
MapIterator.prototype = Object.create( Iterator && Iterator.prototype );
|
|
2796
2899
|
MapIterator.prototype.constructor = MapIterator;
|
|
2797
2900
|
|
|
2798
2901
|
MapIterator.prototype.next = function next () {
|
|
2799
|
-
var this$1 = this;
|
|
2800
|
-
|
|
2801
2902
|
var type = this._type;
|
|
2802
2903
|
var stack = this._stack;
|
|
2803
2904
|
while (stack) {
|
|
@@ -2813,23 +2914,23 @@ var MapIterator = (function (Iterator$$1) {
|
|
|
2813
2914
|
if (index <= maxIndex) {
|
|
2814
2915
|
return mapIteratorValue(
|
|
2815
2916
|
type,
|
|
2816
|
-
node.entries[this
|
|
2917
|
+
node.entries[this._reverse ? maxIndex - index : index]
|
|
2817
2918
|
);
|
|
2818
2919
|
}
|
|
2819
2920
|
} else {
|
|
2820
2921
|
maxIndex = node.nodes.length - 1;
|
|
2821
2922
|
if (index <= maxIndex) {
|
|
2822
|
-
var subNode = node.nodes[this
|
|
2923
|
+
var subNode = node.nodes[this._reverse ? maxIndex - index : index];
|
|
2823
2924
|
if (subNode) {
|
|
2824
2925
|
if (subNode.entry) {
|
|
2825
2926
|
return mapIteratorValue(type, subNode.entry);
|
|
2826
2927
|
}
|
|
2827
|
-
stack = this
|
|
2928
|
+
stack = this._stack = mapIteratorFrame(subNode, stack);
|
|
2828
2929
|
}
|
|
2829
2930
|
continue;
|
|
2830
2931
|
}
|
|
2831
2932
|
}
|
|
2832
|
-
stack = this
|
|
2933
|
+
stack = this._stack = this._stack.__prev;
|
|
2833
2934
|
}
|
|
2834
2935
|
return iteratorDone();
|
|
2835
2936
|
};
|
|
@@ -2845,16 +2946,16 @@ function mapIteratorFrame(node, prev) {
|
|
|
2845
2946
|
return {
|
|
2846
2947
|
node: node,
|
|
2847
2948
|
index: 0,
|
|
2848
|
-
__prev: prev
|
|
2949
|
+
__prev: prev,
|
|
2849
2950
|
};
|
|
2850
2951
|
}
|
|
2851
2952
|
|
|
2852
|
-
function makeMap(size, root, ownerID, hash
|
|
2953
|
+
function makeMap(size, root, ownerID, hash) {
|
|
2853
2954
|
var map = Object.create(MapPrototype);
|
|
2854
2955
|
map.size = size;
|
|
2855
2956
|
map._root = root;
|
|
2856
2957
|
map.__ownerID = ownerID;
|
|
2857
|
-
map.__hash = hash
|
|
2958
|
+
map.__hash = hash;
|
|
2858
2959
|
map.__altered = false;
|
|
2859
2960
|
return map;
|
|
2860
2961
|
}
|
|
@@ -2874,8 +2975,8 @@ function updateMap(map, k, v) {
|
|
|
2874
2975
|
newSize = 1;
|
|
2875
2976
|
newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);
|
|
2876
2977
|
} else {
|
|
2877
|
-
var didChangeSize = MakeRef(
|
|
2878
|
-
var didAlter = MakeRef(
|
|
2978
|
+
var didChangeSize = MakeRef();
|
|
2979
|
+
var didAlter = MakeRef();
|
|
2879
2980
|
newRoot = updateNode(
|
|
2880
2981
|
map._root,
|
|
2881
2982
|
map.__ownerID,
|
|
@@ -3045,16 +3146,22 @@ var MAX_ARRAY_MAP_SIZE = SIZE / 4;
|
|
|
3045
3146
|
var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;
|
|
3046
3147
|
var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;
|
|
3047
3148
|
|
|
3048
|
-
var
|
|
3149
|
+
var IS_LIST_SYMBOL = '@@__IMMUTABLE_LIST__@@';
|
|
3150
|
+
|
|
3151
|
+
function isList(maybeList) {
|
|
3152
|
+
return Boolean(maybeList && maybeList[IS_LIST_SYMBOL]);
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3155
|
+
var List = /*@__PURE__*/(function (IndexedCollection) {
|
|
3049
3156
|
function List(value) {
|
|
3050
3157
|
var empty = emptyList();
|
|
3051
|
-
if (value ===
|
|
3158
|
+
if (value === undefined || value === null) {
|
|
3052
3159
|
return empty;
|
|
3053
3160
|
}
|
|
3054
3161
|
if (isList(value)) {
|
|
3055
3162
|
return value;
|
|
3056
3163
|
}
|
|
3057
|
-
var iter = IndexedCollection
|
|
3164
|
+
var iter = IndexedCollection(value);
|
|
3058
3165
|
var size = iter.size;
|
|
3059
3166
|
if (size === 0) {
|
|
3060
3167
|
return empty;
|
|
@@ -3069,8 +3176,8 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3069
3176
|
});
|
|
3070
3177
|
}
|
|
3071
3178
|
|
|
3072
|
-
if ( IndexedCollection
|
|
3073
|
-
List.prototype = Object.create( IndexedCollection
|
|
3179
|
+
if ( IndexedCollection ) List.__proto__ = IndexedCollection;
|
|
3180
|
+
List.prototype = Object.create( IndexedCollection && IndexedCollection.prototype );
|
|
3074
3181
|
List.prototype.constructor = List;
|
|
3075
3182
|
|
|
3076
3183
|
List.of = function of (/*...values*/) {
|
|
@@ -3103,8 +3210,10 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3103
3210
|
return !this.has(index)
|
|
3104
3211
|
? this
|
|
3105
3212
|
: index === 0
|
|
3106
|
-
|
|
3107
|
-
|
|
3213
|
+
? this.shift()
|
|
3214
|
+
: index === this.size - 1
|
|
3215
|
+
? this.pop()
|
|
3216
|
+
: this.splice(index, 1);
|
|
3108
3217
|
};
|
|
3109
3218
|
|
|
3110
3219
|
List.prototype.insert = function insert (index, value) {
|
|
@@ -3118,8 +3227,7 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3118
3227
|
if (this.__ownerID) {
|
|
3119
3228
|
this.size = this._origin = this._capacity = 0;
|
|
3120
3229
|
this._level = SHIFT;
|
|
3121
|
-
this._root = this._tail =
|
|
3122
|
-
this.__hash = undefined;
|
|
3230
|
+
this._root = this._tail = this.__hash = undefined;
|
|
3123
3231
|
this.__altered = true;
|
|
3124
3232
|
return this;
|
|
3125
3233
|
}
|
|
@@ -3163,7 +3271,7 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3163
3271
|
var seqs = [];
|
|
3164
3272
|
for (var i = 0; i < arguments.length; i++) {
|
|
3165
3273
|
var argument = arguments$1[i];
|
|
3166
|
-
var seq = IndexedCollection
|
|
3274
|
+
var seq = IndexedCollection(
|
|
3167
3275
|
typeof argument !== 'string' && hasIterator(argument)
|
|
3168
3276
|
? argument
|
|
3169
3277
|
: [argument]
|
|
@@ -3187,6 +3295,16 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3187
3295
|
return setListBounds(this, 0, size);
|
|
3188
3296
|
};
|
|
3189
3297
|
|
|
3298
|
+
List.prototype.map = function map (mapper, context) {
|
|
3299
|
+
var this$1$1 = this;
|
|
3300
|
+
|
|
3301
|
+
return this.withMutations(function (list) {
|
|
3302
|
+
for (var i = 0; i < this$1$1.size; i++) {
|
|
3303
|
+
list.set(i, mapper.call(context, list.get(i), i, this$1$1));
|
|
3304
|
+
}
|
|
3305
|
+
});
|
|
3306
|
+
};
|
|
3307
|
+
|
|
3190
3308
|
// @pragma Iteration
|
|
3191
3309
|
|
|
3192
3310
|
List.prototype.slice = function slice (begin, end) {
|
|
@@ -3213,13 +3331,11 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3213
3331
|
};
|
|
3214
3332
|
|
|
3215
3333
|
List.prototype.__iterate = function __iterate (fn, reverse) {
|
|
3216
|
-
var this$1 = this;
|
|
3217
|
-
|
|
3218
3334
|
var index = reverse ? this.size : 0;
|
|
3219
3335
|
var values = iterateList(this, reverse);
|
|
3220
3336
|
var value;
|
|
3221
3337
|
while ((value = values()) !== DONE) {
|
|
3222
|
-
if (fn(value, reverse ? --index : index++, this
|
|
3338
|
+
if (fn(value, reverse ? --index : index++, this) === false) {
|
|
3223
3339
|
break;
|
|
3224
3340
|
}
|
|
3225
3341
|
}
|
|
@@ -3252,32 +3368,26 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3252
3368
|
return List;
|
|
3253
3369
|
}(IndexedCollection));
|
|
3254
3370
|
|
|
3255
|
-
function isList(maybeList) {
|
|
3256
|
-
return !!(maybeList && maybeList[IS_LIST_SENTINEL]);
|
|
3257
|
-
}
|
|
3258
|
-
|
|
3259
3371
|
List.isList = isList;
|
|
3260
3372
|
|
|
3261
|
-
var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
|
|
3262
|
-
|
|
3263
3373
|
var ListPrototype = List.prototype;
|
|
3264
|
-
ListPrototype[
|
|
3374
|
+
ListPrototype[IS_LIST_SYMBOL] = true;
|
|
3265
3375
|
ListPrototype[DELETE] = ListPrototype.remove;
|
|
3266
3376
|
ListPrototype.merge = ListPrototype.concat;
|
|
3267
|
-
ListPrototype.setIn = setIn
|
|
3377
|
+
ListPrototype.setIn = setIn;
|
|
3268
3378
|
ListPrototype.deleteIn = ListPrototype.removeIn = deleteIn;
|
|
3269
|
-
ListPrototype.update = update
|
|
3270
|
-
ListPrototype.updateIn = updateIn
|
|
3379
|
+
ListPrototype.update = update;
|
|
3380
|
+
ListPrototype.updateIn = updateIn;
|
|
3271
3381
|
ListPrototype.mergeIn = mergeIn;
|
|
3272
3382
|
ListPrototype.mergeDeepIn = mergeDeepIn;
|
|
3273
3383
|
ListPrototype.withMutations = withMutations;
|
|
3274
3384
|
ListPrototype.wasAltered = wasAltered;
|
|
3275
3385
|
ListPrototype.asImmutable = asImmutable;
|
|
3276
3386
|
ListPrototype['@@transducer/init'] = ListPrototype.asMutable = asMutable;
|
|
3277
|
-
ListPrototype['@@transducer/step'] = function(result, arr) {
|
|
3387
|
+
ListPrototype['@@transducer/step'] = function (result, arr) {
|
|
3278
3388
|
return result.push(arr);
|
|
3279
3389
|
};
|
|
3280
|
-
ListPrototype['@@transducer/result'] = function(obj) {
|
|
3390
|
+
ListPrototype['@@transducer/result'] = function (obj) {
|
|
3281
3391
|
return obj.asImmutable();
|
|
3282
3392
|
};
|
|
3283
3393
|
|
|
@@ -3289,7 +3399,7 @@ var VNode = function VNode(array, ownerID) {
|
|
|
3289
3399
|
// TODO: seems like these methods are very similar
|
|
3290
3400
|
|
|
3291
3401
|
VNode.prototype.removeBefore = function removeBefore (ownerID, level, index) {
|
|
3292
|
-
if (index === level ? 1 << level :
|
|
3402
|
+
if (index === level ? 1 << level : this.array.length === 0) {
|
|
3293
3403
|
return this;
|
|
3294
3404
|
}
|
|
3295
3405
|
var originIndex = (index >>> level) & MASK;
|
|
@@ -3449,7 +3559,7 @@ function updateList(list, index, value) {
|
|
|
3449
3559
|
|
|
3450
3560
|
var newTail = list._tail;
|
|
3451
3561
|
var newRoot = list._root;
|
|
3452
|
-
var didAlter = MakeRef(
|
|
3562
|
+
var didAlter = MakeRef();
|
|
3453
3563
|
if (index >= getTailOffset(list._capacity)) {
|
|
3454
3564
|
newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);
|
|
3455
3565
|
} else {
|
|
@@ -3508,7 +3618,9 @@ function updateVNode(node, ownerID, level, index, value, didAlter) {
|
|
|
3508
3618
|
return node;
|
|
3509
3619
|
}
|
|
3510
3620
|
|
|
3511
|
-
|
|
3621
|
+
if (didAlter) {
|
|
3622
|
+
SetRef(didAlter);
|
|
3623
|
+
}
|
|
3512
3624
|
|
|
3513
3625
|
newNode = editableVNode(node, ownerID);
|
|
3514
3626
|
if (value === undefined && idx === newNode.array.length - 1) {
|
|
@@ -3557,7 +3669,9 @@ function setListBounds(list, begin, end) {
|
|
|
3557
3669
|
var newCapacity =
|
|
3558
3670
|
end === undefined
|
|
3559
3671
|
? oldCapacity
|
|
3560
|
-
: end < 0
|
|
3672
|
+
: end < 0
|
|
3673
|
+
? oldCapacity + end
|
|
3674
|
+
: oldOrigin + end;
|
|
3561
3675
|
if (newOrigin === oldOrigin && newCapacity === oldCapacity) {
|
|
3562
3676
|
return list;
|
|
3563
3677
|
}
|
|
@@ -3604,7 +3718,9 @@ function setListBounds(list, begin, end) {
|
|
|
3604
3718
|
var newTail =
|
|
3605
3719
|
newTailOffset < oldTailOffset
|
|
3606
3720
|
? listNodeFor(list, newCapacity - 1)
|
|
3607
|
-
: newTailOffset > oldTailOffset
|
|
3721
|
+
: newTailOffset > oldTailOffset
|
|
3722
|
+
? new VNode([], owner)
|
|
3723
|
+
: oldTail;
|
|
3608
3724
|
|
|
3609
3725
|
// Merge Tail into tree.
|
|
3610
3726
|
if (
|
|
@@ -3687,21 +3803,21 @@ function getTailOffset(size) {
|
|
|
3687
3803
|
return size < SIZE ? 0 : ((size - 1) >>> SHIFT) << SHIFT;
|
|
3688
3804
|
}
|
|
3689
3805
|
|
|
3690
|
-
var OrderedMap = (function (Map
|
|
3806
|
+
var OrderedMap = /*@__PURE__*/(function (Map) {
|
|
3691
3807
|
function OrderedMap(value) {
|
|
3692
|
-
return value ===
|
|
3808
|
+
return value === undefined || value === null
|
|
3693
3809
|
? emptyOrderedMap()
|
|
3694
3810
|
: isOrderedMap(value)
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3811
|
+
? value
|
|
3812
|
+
: emptyOrderedMap().withMutations(function (map) {
|
|
3813
|
+
var iter = KeyedCollection(value);
|
|
3814
|
+
assertNotInfinite(iter.size);
|
|
3815
|
+
iter.forEach(function (v, k) { return map.set(k, v); });
|
|
3816
|
+
});
|
|
3701
3817
|
}
|
|
3702
3818
|
|
|
3703
|
-
if ( Map
|
|
3704
|
-
OrderedMap.prototype = Object.create( Map
|
|
3819
|
+
if ( Map ) OrderedMap.__proto__ = Map;
|
|
3820
|
+
OrderedMap.prototype = Object.create( Map && Map.prototype );
|
|
3705
3821
|
OrderedMap.prototype.constructor = OrderedMap;
|
|
3706
3822
|
|
|
3707
3823
|
OrderedMap.of = function of (/*...values*/) {
|
|
@@ -3729,6 +3845,7 @@ var OrderedMap = (function (Map$$1) {
|
|
|
3729
3845
|
this.size = 0;
|
|
3730
3846
|
this._map.clear();
|
|
3731
3847
|
this._list.clear();
|
|
3848
|
+
this.__altered = true;
|
|
3732
3849
|
return this;
|
|
3733
3850
|
}
|
|
3734
3851
|
return emptyOrderedMap();
|
|
@@ -3742,15 +3859,11 @@ var OrderedMap = (function (Map$$1) {
|
|
|
3742
3859
|
return updateOrderedMap(this, k, NOT_SET);
|
|
3743
3860
|
};
|
|
3744
3861
|
|
|
3745
|
-
OrderedMap.prototype.wasAltered = function wasAltered () {
|
|
3746
|
-
return this._map.wasAltered() || this._list.wasAltered();
|
|
3747
|
-
};
|
|
3748
|
-
|
|
3749
3862
|
OrderedMap.prototype.__iterate = function __iterate (fn, reverse) {
|
|
3750
|
-
var this$1 = this;
|
|
3863
|
+
var this$1$1 = this;
|
|
3751
3864
|
|
|
3752
3865
|
return this._list.__iterate(
|
|
3753
|
-
function (entry) { return entry && fn(entry[1], entry[0], this$1); },
|
|
3866
|
+
function (entry) { return entry && fn(entry[1], entry[0], this$1$1); },
|
|
3754
3867
|
reverse
|
|
3755
3868
|
);
|
|
3756
3869
|
};
|
|
@@ -3770,6 +3883,7 @@ var OrderedMap = (function (Map$$1) {
|
|
|
3770
3883
|
return emptyOrderedMap();
|
|
3771
3884
|
}
|
|
3772
3885
|
this.__ownerID = ownerID;
|
|
3886
|
+
this.__altered = false;
|
|
3773
3887
|
this._map = newMap;
|
|
3774
3888
|
this._list = newList;
|
|
3775
3889
|
return this;
|
|
@@ -3780,13 +3894,9 @@ var OrderedMap = (function (Map$$1) {
|
|
|
3780
3894
|
return OrderedMap;
|
|
3781
3895
|
}(Map));
|
|
3782
3896
|
|
|
3783
|
-
function isOrderedMap(maybeOrderedMap) {
|
|
3784
|
-
return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
|
|
3785
|
-
}
|
|
3786
|
-
|
|
3787
3897
|
OrderedMap.isOrderedMap = isOrderedMap;
|
|
3788
3898
|
|
|
3789
|
-
OrderedMap.prototype[
|
|
3899
|
+
OrderedMap.prototype[IS_ORDERED_SYMBOL] = true;
|
|
3790
3900
|
OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;
|
|
3791
3901
|
|
|
3792
3902
|
function makeOrderedMap(map, list, ownerID, hash) {
|
|
@@ -3796,6 +3906,7 @@ function makeOrderedMap(map, list, ownerID, hash) {
|
|
|
3796
3906
|
omap._list = list;
|
|
3797
3907
|
omap.__ownerID = ownerID;
|
|
3798
3908
|
omap.__hash = hash;
|
|
3909
|
+
omap.__altered = false;
|
|
3799
3910
|
return omap;
|
|
3800
3911
|
}
|
|
3801
3912
|
|
|
@@ -3848,20 +3959,29 @@ function updateOrderedMap(omap, k, v) {
|
|
|
3848
3959
|
omap._map = newMap;
|
|
3849
3960
|
omap._list = newList;
|
|
3850
3961
|
omap.__hash = undefined;
|
|
3962
|
+
omap.__altered = true;
|
|
3851
3963
|
return omap;
|
|
3852
3964
|
}
|
|
3853
3965
|
return makeOrderedMap(newMap, newList);
|
|
3854
3966
|
}
|
|
3855
3967
|
|
|
3856
|
-
var
|
|
3968
|
+
var IS_STACK_SYMBOL = '@@__IMMUTABLE_STACK__@@';
|
|
3969
|
+
|
|
3970
|
+
function isStack(maybeStack) {
|
|
3971
|
+
return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);
|
|
3972
|
+
}
|
|
3973
|
+
|
|
3974
|
+
var Stack = /*@__PURE__*/(function (IndexedCollection) {
|
|
3857
3975
|
function Stack(value) {
|
|
3858
|
-
return value ===
|
|
3976
|
+
return value === undefined || value === null
|
|
3859
3977
|
? emptyStack()
|
|
3860
|
-
: isStack(value)
|
|
3978
|
+
: isStack(value)
|
|
3979
|
+
? value
|
|
3980
|
+
: emptyStack().pushAll(value);
|
|
3861
3981
|
}
|
|
3862
3982
|
|
|
3863
|
-
if ( IndexedCollection
|
|
3864
|
-
Stack.prototype = Object.create( IndexedCollection
|
|
3983
|
+
if ( IndexedCollection ) Stack.__proto__ = IndexedCollection;
|
|
3984
|
+
Stack.prototype = Object.create( IndexedCollection && IndexedCollection.prototype );
|
|
3865
3985
|
Stack.prototype.constructor = Stack;
|
|
3866
3986
|
|
|
3867
3987
|
Stack.of = function of (/*...values*/) {
|
|
@@ -3900,7 +4020,7 @@ var Stack = (function (IndexedCollection$$1) {
|
|
|
3900
4020
|
for (var ii = arguments.length - 1; ii >= 0; ii--) {
|
|
3901
4021
|
head = {
|
|
3902
4022
|
value: arguments$1[ii],
|
|
3903
|
-
next: head
|
|
4023
|
+
next: head,
|
|
3904
4024
|
};
|
|
3905
4025
|
}
|
|
3906
4026
|
if (this.__ownerID) {
|
|
@@ -3914,7 +4034,7 @@ var Stack = (function (IndexedCollection$$1) {
|
|
|
3914
4034
|
};
|
|
3915
4035
|
|
|
3916
4036
|
Stack.prototype.pushAll = function pushAll (iter) {
|
|
3917
|
-
iter = IndexedCollection
|
|
4037
|
+
iter = IndexedCollection(iter);
|
|
3918
4038
|
if (iter.size === 0) {
|
|
3919
4039
|
return this;
|
|
3920
4040
|
}
|
|
@@ -3928,7 +4048,7 @@ var Stack = (function (IndexedCollection$$1) {
|
|
|
3928
4048
|
newSize++;
|
|
3929
4049
|
head = {
|
|
3930
4050
|
value: value,
|
|
3931
|
-
next: head
|
|
4051
|
+
next: head,
|
|
3932
4052
|
};
|
|
3933
4053
|
}, /* reverse */ true);
|
|
3934
4054
|
if (this.__ownerID) {
|
|
@@ -3967,7 +4087,7 @@ var Stack = (function (IndexedCollection$$1) {
|
|
|
3967
4087
|
var resolvedEnd = resolveEnd(end, this.size);
|
|
3968
4088
|
if (resolvedEnd !== this.size) {
|
|
3969
4089
|
// super.slice(begin, end);
|
|
3970
|
-
return IndexedCollection
|
|
4090
|
+
return IndexedCollection.prototype.slice.call(this, begin, end);
|
|
3971
4091
|
}
|
|
3972
4092
|
var newSize = this.size - resolvedBegin;
|
|
3973
4093
|
var head = this._head;
|
|
@@ -4004,18 +4124,18 @@ var Stack = (function (IndexedCollection$$1) {
|
|
|
4004
4124
|
// @pragma Iteration
|
|
4005
4125
|
|
|
4006
4126
|
Stack.prototype.__iterate = function __iterate (fn, reverse) {
|
|
4007
|
-
var this$1 = this;
|
|
4127
|
+
var this$1$1 = this;
|
|
4008
4128
|
|
|
4009
4129
|
if (reverse) {
|
|
4010
4130
|
return new ArraySeq(this.toArray()).__iterate(
|
|
4011
|
-
function (v, k) { return fn(v, k, this$1); },
|
|
4131
|
+
function (v, k) { return fn(v, k, this$1$1); },
|
|
4012
4132
|
reverse
|
|
4013
4133
|
);
|
|
4014
4134
|
}
|
|
4015
4135
|
var iterations = 0;
|
|
4016
4136
|
var node = this._head;
|
|
4017
4137
|
while (node) {
|
|
4018
|
-
if (fn(node.value, iterations++, this
|
|
4138
|
+
if (fn(node.value, iterations++, this) === false) {
|
|
4019
4139
|
break;
|
|
4020
4140
|
}
|
|
4021
4141
|
node = node.next;
|
|
@@ -4042,16 +4162,10 @@ var Stack = (function (IndexedCollection$$1) {
|
|
|
4042
4162
|
return Stack;
|
|
4043
4163
|
}(IndexedCollection));
|
|
4044
4164
|
|
|
4045
|
-
function isStack(maybeStack) {
|
|
4046
|
-
return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]);
|
|
4047
|
-
}
|
|
4048
|
-
|
|
4049
4165
|
Stack.isStack = isStack;
|
|
4050
4166
|
|
|
4051
|
-
var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
|
|
4052
|
-
|
|
4053
4167
|
var StackPrototype = Stack.prototype;
|
|
4054
|
-
StackPrototype[
|
|
4168
|
+
StackPrototype[IS_STACK_SYMBOL] = true;
|
|
4055
4169
|
StackPrototype.shift = StackPrototype.pop;
|
|
4056
4170
|
StackPrototype.unshift = StackPrototype.push;
|
|
4057
4171
|
StackPrototype.unshiftAll = StackPrototype.pushAll;
|
|
@@ -4059,10 +4173,10 @@ StackPrototype.withMutations = withMutations;
|
|
|
4059
4173
|
StackPrototype.wasAltered = wasAltered;
|
|
4060
4174
|
StackPrototype.asImmutable = asImmutable;
|
|
4061
4175
|
StackPrototype['@@transducer/init'] = StackPrototype.asMutable = asMutable;
|
|
4062
|
-
StackPrototype['@@transducer/step'] = function(result, arr) {
|
|
4176
|
+
StackPrototype['@@transducer/step'] = function (result, arr) {
|
|
4063
4177
|
return result.unshift(arr);
|
|
4064
4178
|
};
|
|
4065
|
-
StackPrototype['@@transducer/result'] = function(obj) {
|
|
4179
|
+
StackPrototype['@@transducer/result'] = function (obj) {
|
|
4066
4180
|
return obj.asImmutable();
|
|
4067
4181
|
};
|
|
4068
4182
|
|
|
@@ -4081,6 +4195,16 @@ function emptyStack() {
|
|
|
4081
4195
|
return EMPTY_STACK || (EMPTY_STACK = makeStack(0));
|
|
4082
4196
|
}
|
|
4083
4197
|
|
|
4198
|
+
var IS_SET_SYMBOL = '@@__IMMUTABLE_SET__@@';
|
|
4199
|
+
|
|
4200
|
+
function isSet(maybeSet) {
|
|
4201
|
+
return Boolean(maybeSet && maybeSet[IS_SET_SYMBOL]);
|
|
4202
|
+
}
|
|
4203
|
+
|
|
4204
|
+
function isOrderedSet(maybeOrderedSet) {
|
|
4205
|
+
return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
|
|
4206
|
+
}
|
|
4207
|
+
|
|
4084
4208
|
function deepEqual(a, b) {
|
|
4085
4209
|
if (a === b) {
|
|
4086
4210
|
return true;
|
|
@@ -4135,7 +4259,9 @@ function deepEqual(a, b) {
|
|
|
4135
4259
|
if (
|
|
4136
4260
|
notAssociative
|
|
4137
4261
|
? !a.has(v)
|
|
4138
|
-
: flipped
|
|
4262
|
+
: flipped
|
|
4263
|
+
? !is(v, a.get(k, NOT_SET))
|
|
4264
|
+
: !is(a.get(k, NOT_SET), v)
|
|
4139
4265
|
) {
|
|
4140
4266
|
allEqual = false;
|
|
4141
4267
|
return false;
|
|
@@ -4145,9 +4271,6 @@ function deepEqual(a, b) {
|
|
|
4145
4271
|
return allEqual && a.size === bSize;
|
|
4146
4272
|
}
|
|
4147
4273
|
|
|
4148
|
-
/**
|
|
4149
|
-
* Contributes additional methods to a constructor
|
|
4150
|
-
*/
|
|
4151
4274
|
function mixin(ctor, methods) {
|
|
4152
4275
|
var keyCopier = function (key) {
|
|
4153
4276
|
ctor.prototype[key] = methods[key];
|
|
@@ -4159,28 +4282,44 @@ function mixin(ctor, methods) {
|
|
|
4159
4282
|
}
|
|
4160
4283
|
|
|
4161
4284
|
function toJS(value) {
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4285
|
+
if (!value || typeof value !== 'object') {
|
|
4286
|
+
return value;
|
|
4287
|
+
}
|
|
4288
|
+
if (!isCollection(value)) {
|
|
4289
|
+
if (!isDataStructure(value)) {
|
|
4290
|
+
return value;
|
|
4291
|
+
}
|
|
4292
|
+
value = Seq(value);
|
|
4293
|
+
}
|
|
4294
|
+
if (isKeyed(value)) {
|
|
4295
|
+
var result$1 = {};
|
|
4296
|
+
value.__iterate(function (v, k) {
|
|
4297
|
+
result$1[k] = toJS(v);
|
|
4298
|
+
});
|
|
4299
|
+
return result$1;
|
|
4300
|
+
}
|
|
4301
|
+
var result = [];
|
|
4302
|
+
value.__iterate(function (v) {
|
|
4303
|
+
result.push(toJS(v));
|
|
4304
|
+
});
|
|
4305
|
+
return result;
|
|
4167
4306
|
}
|
|
4168
4307
|
|
|
4169
|
-
var Set = (function (SetCollection
|
|
4308
|
+
var Set = /*@__PURE__*/(function (SetCollection) {
|
|
4170
4309
|
function Set(value) {
|
|
4171
|
-
return value ===
|
|
4310
|
+
return value === undefined || value === null
|
|
4172
4311
|
? emptySet()
|
|
4173
4312
|
: isSet(value) && !isOrdered(value)
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4313
|
+
? value
|
|
4314
|
+
: emptySet().withMutations(function (set) {
|
|
4315
|
+
var iter = SetCollection(value);
|
|
4316
|
+
assertNotInfinite(iter.size);
|
|
4317
|
+
iter.forEach(function (v) { return set.add(v); });
|
|
4318
|
+
});
|
|
4180
4319
|
}
|
|
4181
4320
|
|
|
4182
|
-
if ( SetCollection
|
|
4183
|
-
Set.prototype = Object.create( SetCollection
|
|
4321
|
+
if ( SetCollection ) Set.__proto__ = SetCollection;
|
|
4322
|
+
Set.prototype = Object.create( SetCollection && SetCollection.prototype );
|
|
4184
4323
|
Set.prototype.constructor = Set;
|
|
4185
4324
|
|
|
4186
4325
|
Set.of = function of (/*...values*/) {
|
|
@@ -4231,6 +4370,30 @@ var Set = (function (SetCollection$$1) {
|
|
|
4231
4370
|
|
|
4232
4371
|
// @pragma Composition
|
|
4233
4372
|
|
|
4373
|
+
Set.prototype.map = function map (mapper, context) {
|
|
4374
|
+
var this$1$1 = this;
|
|
4375
|
+
|
|
4376
|
+
// keep track if the set is altered by the map function
|
|
4377
|
+
var didChanges = false;
|
|
4378
|
+
|
|
4379
|
+
var newMap = updateSet(
|
|
4380
|
+
this,
|
|
4381
|
+
this._map.mapEntries(function (ref) {
|
|
4382
|
+
var v = ref[1];
|
|
4383
|
+
|
|
4384
|
+
var mapped = mapper.call(context, v, v, this$1$1);
|
|
4385
|
+
|
|
4386
|
+
if (mapped !== v) {
|
|
4387
|
+
didChanges = true;
|
|
4388
|
+
}
|
|
4389
|
+
|
|
4390
|
+
return [mapped, mapped];
|
|
4391
|
+
}, context)
|
|
4392
|
+
);
|
|
4393
|
+
|
|
4394
|
+
return didChanges ? newMap : this;
|
|
4395
|
+
};
|
|
4396
|
+
|
|
4234
4397
|
Set.prototype.union = function union () {
|
|
4235
4398
|
var iters = [], len = arguments.length;
|
|
4236
4399
|
while ( len-- ) iters[ len ] = arguments[ len ];
|
|
@@ -4244,7 +4407,7 @@ var Set = (function (SetCollection$$1) {
|
|
|
4244
4407
|
}
|
|
4245
4408
|
return this.withMutations(function (set) {
|
|
4246
4409
|
for (var ii = 0; ii < iters.length; ii++) {
|
|
4247
|
-
SetCollection
|
|
4410
|
+
SetCollection(iters[ii]).forEach(function (value) { return set.add(value); });
|
|
4248
4411
|
}
|
|
4249
4412
|
});
|
|
4250
4413
|
};
|
|
@@ -4256,7 +4419,7 @@ var Set = (function (SetCollection$$1) {
|
|
|
4256
4419
|
if (iters.length === 0) {
|
|
4257
4420
|
return this;
|
|
4258
4421
|
}
|
|
4259
|
-
iters = iters.map(function (iter) { return SetCollection
|
|
4422
|
+
iters = iters.map(function (iter) { return SetCollection(iter); });
|
|
4260
4423
|
var toRemove = [];
|
|
4261
4424
|
this.forEach(function (value) {
|
|
4262
4425
|
if (!iters.every(function (iter) { return iter.includes(value); })) {
|
|
@@ -4277,7 +4440,7 @@ var Set = (function (SetCollection$$1) {
|
|
|
4277
4440
|
if (iters.length === 0) {
|
|
4278
4441
|
return this;
|
|
4279
4442
|
}
|
|
4280
|
-
iters = iters.map(function (iter) { return SetCollection
|
|
4443
|
+
iters = iters.map(function (iter) { return SetCollection(iter); });
|
|
4281
4444
|
var toRemove = [];
|
|
4282
4445
|
this.forEach(function (value) {
|
|
4283
4446
|
if (iters.some(function (iter) { return iter.includes(value); })) {
|
|
@@ -4306,9 +4469,9 @@ var Set = (function (SetCollection$$1) {
|
|
|
4306
4469
|
};
|
|
4307
4470
|
|
|
4308
4471
|
Set.prototype.__iterate = function __iterate (fn, reverse) {
|
|
4309
|
-
var this$1 = this;
|
|
4472
|
+
var this$1$1 = this;
|
|
4310
4473
|
|
|
4311
|
-
return this._map.__iterate(function (k) { return fn(k, k, this$1); }, reverse);
|
|
4474
|
+
return this._map.__iterate(function (k) { return fn(k, k, this$1$1); }, reverse);
|
|
4312
4475
|
};
|
|
4313
4476
|
|
|
4314
4477
|
Set.prototype.__iterator = function __iterator (type, reverse) {
|
|
@@ -4334,25 +4497,19 @@ var Set = (function (SetCollection$$1) {
|
|
|
4334
4497
|
return Set;
|
|
4335
4498
|
}(SetCollection));
|
|
4336
4499
|
|
|
4337
|
-
function isSet(maybeSet) {
|
|
4338
|
-
return !!(maybeSet && maybeSet[IS_SET_SENTINEL]);
|
|
4339
|
-
}
|
|
4340
|
-
|
|
4341
4500
|
Set.isSet = isSet;
|
|
4342
4501
|
|
|
4343
|
-
var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
|
|
4344
|
-
|
|
4345
4502
|
var SetPrototype = Set.prototype;
|
|
4346
|
-
SetPrototype[
|
|
4503
|
+
SetPrototype[IS_SET_SYMBOL] = true;
|
|
4347
4504
|
SetPrototype[DELETE] = SetPrototype.remove;
|
|
4348
4505
|
SetPrototype.merge = SetPrototype.concat = SetPrototype.union;
|
|
4349
4506
|
SetPrototype.withMutations = withMutations;
|
|
4350
4507
|
SetPrototype.asImmutable = asImmutable;
|
|
4351
4508
|
SetPrototype['@@transducer/init'] = SetPrototype.asMutable = asMutable;
|
|
4352
|
-
SetPrototype['@@transducer/step'] = function(result, arr) {
|
|
4509
|
+
SetPrototype['@@transducer/step'] = function (result, arr) {
|
|
4353
4510
|
return result.add(arr);
|
|
4354
4511
|
};
|
|
4355
|
-
SetPrototype['@@transducer/result'] = function(obj) {
|
|
4512
|
+
SetPrototype['@@transducer/result'] = function (obj) {
|
|
4356
4513
|
return obj.asImmutable();
|
|
4357
4514
|
};
|
|
4358
4515
|
|
|
@@ -4367,7 +4524,9 @@ function updateSet(set, newMap) {
|
|
|
4367
4524
|
}
|
|
4368
4525
|
return newMap === set._map
|
|
4369
4526
|
? set
|
|
4370
|
-
: newMap.size === 0
|
|
4527
|
+
: newMap.size === 0
|
|
4528
|
+
? set.__empty()
|
|
4529
|
+
: set.__make(newMap);
|
|
4371
4530
|
}
|
|
4372
4531
|
|
|
4373
4532
|
function makeSet(map, ownerID) {
|
|
@@ -4388,7 +4547,7 @@ function emptySet() {
|
|
|
4388
4547
|
* (exclusive), by step, where start defaults to 0, step to 1, and end to
|
|
4389
4548
|
* infinity. When start is equal to end, returns empty list.
|
|
4390
4549
|
*/
|
|
4391
|
-
var Range = (function (IndexedSeq
|
|
4550
|
+
var Range = /*@__PURE__*/(function (IndexedSeq) {
|
|
4392
4551
|
function Range(start, end, step) {
|
|
4393
4552
|
if (!(this instanceof Range)) {
|
|
4394
4553
|
return new Range(start, end, step);
|
|
@@ -4414,8 +4573,8 @@ var Range = (function (IndexedSeq$$1) {
|
|
|
4414
4573
|
}
|
|
4415
4574
|
}
|
|
4416
4575
|
|
|
4417
|
-
if ( IndexedSeq
|
|
4418
|
-
Range.prototype = Object.create( IndexedSeq
|
|
4576
|
+
if ( IndexedSeq ) Range.__proto__ = IndexedSeq;
|
|
4577
|
+
Range.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
|
|
4419
4578
|
Range.prototype.constructor = Range;
|
|
4420
4579
|
|
|
4421
4580
|
Range.prototype.toString = function toString () {
|
|
@@ -4479,14 +4638,12 @@ var Range = (function (IndexedSeq$$1) {
|
|
|
4479
4638
|
};
|
|
4480
4639
|
|
|
4481
4640
|
Range.prototype.__iterate = function __iterate (fn, reverse) {
|
|
4482
|
-
var this$1 = this;
|
|
4483
|
-
|
|
4484
4641
|
var size = this.size;
|
|
4485
4642
|
var step = this._step;
|
|
4486
4643
|
var value = reverse ? this._start + (size - 1) * step : this._start;
|
|
4487
4644
|
var i = 0;
|
|
4488
4645
|
while (i !== size) {
|
|
4489
|
-
if (fn(value, reverse ? size - ++i : i++, this
|
|
4646
|
+
if (fn(value, reverse ? size - ++i : i++, this) === false) {
|
|
4490
4647
|
break;
|
|
4491
4648
|
}
|
|
4492
4649
|
value += reverse ? -step : step;
|
|
@@ -4534,7 +4691,7 @@ function getIn$1(collection, searchKeyPath, notSetValue) {
|
|
|
4534
4691
|
return collection;
|
|
4535
4692
|
}
|
|
4536
4693
|
|
|
4537
|
-
function getIn
|
|
4694
|
+
function getIn(searchKeyPath, notSetValue) {
|
|
4538
4695
|
return getIn$1(this, searchKeyPath, notSetValue);
|
|
4539
4696
|
}
|
|
4540
4697
|
|
|
@@ -4542,7 +4699,7 @@ function hasIn$1(collection, keyPath) {
|
|
|
4542
4699
|
return getIn$1(collection, keyPath, NOT_SET) !== NOT_SET;
|
|
4543
4700
|
}
|
|
4544
4701
|
|
|
4545
|
-
function hasIn
|
|
4702
|
+
function hasIn(searchKeyPath) {
|
|
4546
4703
|
return hasIn$1(this, searchKeyPath);
|
|
4547
4704
|
}
|
|
4548
4705
|
|
|
@@ -4620,7 +4777,9 @@ mixin(Collection, {
|
|
|
4620
4777
|
toSeq: function toSeq() {
|
|
4621
4778
|
return isIndexed(this)
|
|
4622
4779
|
? this.toIndexedSeq()
|
|
4623
|
-
: isKeyed(this)
|
|
4780
|
+
: isKeyed(this)
|
|
4781
|
+
? this.toKeyedSeq()
|
|
4782
|
+
: this.toSetSeq();
|
|
4624
4783
|
},
|
|
4625
4784
|
|
|
4626
4785
|
toStack: function toStack() {
|
|
@@ -4646,9 +4805,7 @@ mixin(Collection, {
|
|
|
4646
4805
|
return (
|
|
4647
4806
|
head +
|
|
4648
4807
|
' ' +
|
|
4649
|
-
this.toSeq()
|
|
4650
|
-
.map(this.__toStringMapper)
|
|
4651
|
-
.join(', ') +
|
|
4808
|
+
this.toSeq().map(this.__toStringMapper).join(', ') +
|
|
4652
4809
|
' ' +
|
|
4653
4810
|
tail
|
|
4654
4811
|
);
|
|
@@ -4789,10 +4946,7 @@ mixin(Collection, {
|
|
|
4789
4946
|
// We cache as an entries array, so we can just return the cache!
|
|
4790
4947
|
return new ArraySeq(collection._cache);
|
|
4791
4948
|
}
|
|
4792
|
-
var entriesSequence = collection
|
|
4793
|
-
.toSeq()
|
|
4794
|
-
.map(entryMapper)
|
|
4795
|
-
.toIndexedSeq();
|
|
4949
|
+
var entriesSequence = collection.toSeq().map(entryMapper).toIndexedSeq();
|
|
4796
4950
|
entriesSequence.fromEntrySeq = function () { return collection.toSeq(); };
|
|
4797
4951
|
return entriesSequence;
|
|
4798
4952
|
},
|
|
@@ -4818,9 +4972,7 @@ mixin(Collection, {
|
|
|
4818
4972
|
},
|
|
4819
4973
|
|
|
4820
4974
|
findLast: function findLast(predicate, context, notSetValue) {
|
|
4821
|
-
return this.toKeyedSeq()
|
|
4822
|
-
.reverse()
|
|
4823
|
-
.find(predicate, context, notSetValue);
|
|
4975
|
+
return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);
|
|
4824
4976
|
},
|
|
4825
4977
|
|
|
4826
4978
|
findLastEntry: function findLastEntry(predicate, context, notSetValue) {
|
|
@@ -4830,13 +4982,11 @@ mixin(Collection, {
|
|
|
4830
4982
|
},
|
|
4831
4983
|
|
|
4832
4984
|
findLastKey: function findLastKey(predicate, context) {
|
|
4833
|
-
return this.toKeyedSeq()
|
|
4834
|
-
.reverse()
|
|
4835
|
-
.findKey(predicate, context);
|
|
4985
|
+
return this.toKeyedSeq().reverse().findKey(predicate, context);
|
|
4836
4986
|
},
|
|
4837
4987
|
|
|
4838
|
-
first: function first() {
|
|
4839
|
-
return this.find(returnTrue);
|
|
4988
|
+
first: function first(notSetValue) {
|
|
4989
|
+
return this.find(returnTrue, null, notSetValue);
|
|
4840
4990
|
},
|
|
4841
4991
|
|
|
4842
4992
|
flatMap: function flatMap(mapper, context) {
|
|
@@ -4855,7 +5005,7 @@ mixin(Collection, {
|
|
|
4855
5005
|
return this.find(function (_, key) { return is(key, searchKey); }, undefined, notSetValue);
|
|
4856
5006
|
},
|
|
4857
5007
|
|
|
4858
|
-
getIn: getIn
|
|
5008
|
+
getIn: getIn,
|
|
4859
5009
|
|
|
4860
5010
|
groupBy: function groupBy(grouper, context) {
|
|
4861
5011
|
return groupByFactory(this, grouper, context);
|
|
@@ -4865,7 +5015,7 @@ mixin(Collection, {
|
|
|
4865
5015
|
return this.get(searchKey, NOT_SET) !== NOT_SET;
|
|
4866
5016
|
},
|
|
4867
5017
|
|
|
4868
|
-
hasIn: hasIn
|
|
5018
|
+
hasIn: hasIn,
|
|
4869
5019
|
|
|
4870
5020
|
isSubset: function isSubset(iter) {
|
|
4871
5021
|
iter = typeof iter.includes === 'function' ? iter : Collection(iter);
|
|
@@ -4882,21 +5032,15 @@ mixin(Collection, {
|
|
|
4882
5032
|
},
|
|
4883
5033
|
|
|
4884
5034
|
keySeq: function keySeq() {
|
|
4885
|
-
return this.toSeq()
|
|
4886
|
-
.map(keyMapper)
|
|
4887
|
-
.toIndexedSeq();
|
|
5035
|
+
return this.toSeq().map(keyMapper).toIndexedSeq();
|
|
4888
5036
|
},
|
|
4889
5037
|
|
|
4890
|
-
last: function last() {
|
|
4891
|
-
return this.toSeq()
|
|
4892
|
-
.reverse()
|
|
4893
|
-
.first();
|
|
5038
|
+
last: function last(notSetValue) {
|
|
5039
|
+
return this.toSeq().reverse().first(notSetValue);
|
|
4894
5040
|
},
|
|
4895
5041
|
|
|
4896
5042
|
lastKeyOf: function lastKeyOf(searchValue) {
|
|
4897
|
-
return this.toKeyedSeq()
|
|
4898
|
-
.reverse()
|
|
4899
|
-
.keyOf(searchValue);
|
|
5043
|
+
return this.toKeyedSeq().reverse().keyOf(searchValue);
|
|
4900
5044
|
},
|
|
4901
5045
|
|
|
4902
5046
|
max: function max(comparator) {
|
|
@@ -4974,7 +5118,7 @@ mixin(Collection, {
|
|
|
4974
5118
|
|
|
4975
5119
|
hashCode: function hashCode() {
|
|
4976
5120
|
return this.__hash || (this.__hash = hashCollection(this));
|
|
4977
|
-
}
|
|
5121
|
+
},
|
|
4978
5122
|
|
|
4979
5123
|
// ### Internal
|
|
4980
5124
|
|
|
@@ -4984,11 +5128,11 @@ mixin(Collection, {
|
|
|
4984
5128
|
});
|
|
4985
5129
|
|
|
4986
5130
|
var CollectionPrototype = Collection.prototype;
|
|
4987
|
-
CollectionPrototype[
|
|
5131
|
+
CollectionPrototype[IS_COLLECTION_SYMBOL] = true;
|
|
4988
5132
|
CollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.values;
|
|
4989
5133
|
CollectionPrototype.toJSON = CollectionPrototype.toArray;
|
|
4990
5134
|
CollectionPrototype.__toStringMapper = quoteString;
|
|
4991
|
-
CollectionPrototype.inspect = CollectionPrototype.toSource = function() {
|
|
5135
|
+
CollectionPrototype.inspect = CollectionPrototype.toSource = function () {
|
|
4992
5136
|
return this.toString();
|
|
4993
5137
|
};
|
|
4994
5138
|
CollectionPrototype.chain = CollectionPrototype.flatMap;
|
|
@@ -5002,32 +5146,32 @@ mixin(KeyedCollection, {
|
|
|
5002
5146
|
},
|
|
5003
5147
|
|
|
5004
5148
|
mapEntries: function mapEntries(mapper, context) {
|
|
5005
|
-
var this$1 = this;
|
|
5149
|
+
var this$1$1 = this;
|
|
5006
5150
|
|
|
5007
5151
|
var iterations = 0;
|
|
5008
5152
|
return reify(
|
|
5009
5153
|
this,
|
|
5010
5154
|
this.toSeq()
|
|
5011
|
-
.map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1); })
|
|
5155
|
+
.map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1$1); })
|
|
5012
5156
|
.fromEntrySeq()
|
|
5013
5157
|
);
|
|
5014
5158
|
},
|
|
5015
5159
|
|
|
5016
5160
|
mapKeys: function mapKeys(mapper, context) {
|
|
5017
|
-
var this$1 = this;
|
|
5161
|
+
var this$1$1 = this;
|
|
5018
5162
|
|
|
5019
5163
|
return reify(
|
|
5020
5164
|
this,
|
|
5021
5165
|
this.toSeq()
|
|
5022
5166
|
.flip()
|
|
5023
|
-
.map(function (k, v) { return mapper.call(context, k, v, this$1); })
|
|
5167
|
+
.map(function (k, v) { return mapper.call(context, k, v, this$1$1); })
|
|
5024
5168
|
.flip()
|
|
5025
5169
|
);
|
|
5026
|
-
}
|
|
5170
|
+
},
|
|
5027
5171
|
});
|
|
5028
5172
|
|
|
5029
5173
|
var KeyedCollectionPrototype = KeyedCollection.prototype;
|
|
5030
|
-
KeyedCollectionPrototype[
|
|
5174
|
+
KeyedCollectionPrototype[IS_KEYED_SYMBOL] = true;
|
|
5031
5175
|
KeyedCollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.entries;
|
|
5032
5176
|
KeyedCollectionPrototype.toJSON = toObject;
|
|
5033
5177
|
KeyedCollectionPrototype.__toStringMapper = function (v, k) { return quoteString(k) + ': ' + quoteString(v); };
|
|
@@ -5094,8 +5238,8 @@ mixin(IndexedCollection, {
|
|
|
5094
5238
|
return entry ? entry[0] : -1;
|
|
5095
5239
|
},
|
|
5096
5240
|
|
|
5097
|
-
first: function first() {
|
|
5098
|
-
return this.get(0);
|
|
5241
|
+
first: function first(notSetValue) {
|
|
5242
|
+
return this.get(0, notSetValue);
|
|
5099
5243
|
},
|
|
5100
5244
|
|
|
5101
5245
|
flatten: function flatten(depth) {
|
|
@@ -5105,7 +5249,8 @@ mixin(IndexedCollection, {
|
|
|
5105
5249
|
get: function get(index, notSetValue) {
|
|
5106
5250
|
index = wrapIndex(this, index);
|
|
5107
5251
|
return index < 0 ||
|
|
5108
|
-
|
|
5252
|
+
this.size === Infinity ||
|
|
5253
|
+
(this.size !== undefined && index > this.size)
|
|
5109
5254
|
? notSetValue
|
|
5110
5255
|
: this.find(function (_, key) { return key === index; }, undefined, notSetValue);
|
|
5111
5256
|
},
|
|
@@ -5138,8 +5283,8 @@ mixin(IndexedCollection, {
|
|
|
5138
5283
|
return Range(0, this.size);
|
|
5139
5284
|
},
|
|
5140
5285
|
|
|
5141
|
-
last: function last() {
|
|
5142
|
-
return this.get(-1);
|
|
5286
|
+
last: function last(notSetValue) {
|
|
5287
|
+
return this.get(-1, notSetValue);
|
|
5143
5288
|
},
|
|
5144
5289
|
|
|
5145
5290
|
skipWhile: function skipWhile(predicate, context) {
|
|
@@ -5160,12 +5305,12 @@ mixin(IndexedCollection, {
|
|
|
5160
5305
|
var collections = arrCopy(arguments);
|
|
5161
5306
|
collections[0] = this;
|
|
5162
5307
|
return reify(this, zipWithFactory(this, zipper, collections));
|
|
5163
|
-
}
|
|
5308
|
+
},
|
|
5164
5309
|
});
|
|
5165
5310
|
|
|
5166
5311
|
var IndexedCollectionPrototype = IndexedCollection.prototype;
|
|
5167
|
-
IndexedCollectionPrototype[
|
|
5168
|
-
IndexedCollectionPrototype[
|
|
5312
|
+
IndexedCollectionPrototype[IS_INDEXED_SYMBOL] = true;
|
|
5313
|
+
IndexedCollectionPrototype[IS_ORDERED_SYMBOL] = true;
|
|
5169
5314
|
|
|
5170
5315
|
mixin(SetCollection, {
|
|
5171
5316
|
// ### ES6 Collection methods (ES6 Array and Map)
|
|
@@ -5182,17 +5327,19 @@ mixin(SetCollection, {
|
|
|
5182
5327
|
|
|
5183
5328
|
keySeq: function keySeq() {
|
|
5184
5329
|
return this.valueSeq();
|
|
5185
|
-
}
|
|
5330
|
+
},
|
|
5186
5331
|
});
|
|
5187
5332
|
|
|
5188
|
-
|
|
5189
|
-
|
|
5333
|
+
var SetCollectionPrototype = SetCollection.prototype;
|
|
5334
|
+
SetCollectionPrototype.has = CollectionPrototype.includes;
|
|
5335
|
+
SetCollectionPrototype.contains = SetCollectionPrototype.includes;
|
|
5336
|
+
SetCollectionPrototype.keys = SetCollectionPrototype.values;
|
|
5190
5337
|
|
|
5191
5338
|
// Mixin subclasses
|
|
5192
5339
|
|
|
5193
|
-
mixin(KeyedSeq,
|
|
5194
|
-
mixin(IndexedSeq,
|
|
5195
|
-
mixin(SetSeq,
|
|
5340
|
+
mixin(KeyedSeq, KeyedCollectionPrototype);
|
|
5341
|
+
mixin(IndexedSeq, IndexedCollectionPrototype);
|
|
5342
|
+
mixin(SetSeq, SetCollectionPrototype);
|
|
5196
5343
|
|
|
5197
5344
|
// #pragma Helper functions
|
|
5198
5345
|
|
|
@@ -5218,13 +5365,13 @@ function entryMapper(v, k) {
|
|
|
5218
5365
|
}
|
|
5219
5366
|
|
|
5220
5367
|
function not(predicate) {
|
|
5221
|
-
return function() {
|
|
5368
|
+
return function () {
|
|
5222
5369
|
return !predicate.apply(this, arguments);
|
|
5223
5370
|
};
|
|
5224
5371
|
}
|
|
5225
5372
|
|
|
5226
5373
|
function neg(predicate) {
|
|
5227
|
-
return function() {
|
|
5374
|
+
return function () {
|
|
5228
5375
|
return -predicate.apply(this, arguments);
|
|
5229
5376
|
};
|
|
5230
5377
|
}
|
|
@@ -5254,12 +5401,12 @@ function hashCollection(collection) {
|
|
|
5254
5401
|
h = (h + hashMerge(hash(v), hash(k))) | 0;
|
|
5255
5402
|
}
|
|
5256
5403
|
: ordered
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5404
|
+
? function (v) {
|
|
5405
|
+
h = (31 * h + hash(v)) | 0;
|
|
5406
|
+
}
|
|
5407
|
+
: function (v) {
|
|
5408
|
+
h = (h + hash(v)) | 0;
|
|
5409
|
+
}
|
|
5263
5410
|
);
|
|
5264
5411
|
return murmurHashOfSize(size, h);
|
|
5265
5412
|
}
|
|
@@ -5279,21 +5426,21 @@ function hashMerge(a, b) {
|
|
|
5279
5426
|
return (a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2))) | 0; // int
|
|
5280
5427
|
}
|
|
5281
5428
|
|
|
5282
|
-
var OrderedSet = (function (Set
|
|
5429
|
+
var OrderedSet = /*@__PURE__*/(function (Set) {
|
|
5283
5430
|
function OrderedSet(value) {
|
|
5284
|
-
return value ===
|
|
5431
|
+
return value === undefined || value === null
|
|
5285
5432
|
? emptyOrderedSet()
|
|
5286
5433
|
: isOrderedSet(value)
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5434
|
+
? value
|
|
5435
|
+
: emptyOrderedSet().withMutations(function (set) {
|
|
5436
|
+
var iter = SetCollection(value);
|
|
5437
|
+
assertNotInfinite(iter.size);
|
|
5438
|
+
iter.forEach(function (v) { return set.add(v); });
|
|
5439
|
+
});
|
|
5293
5440
|
}
|
|
5294
5441
|
|
|
5295
|
-
if ( Set
|
|
5296
|
-
OrderedSet.prototype = Object.create( Set
|
|
5442
|
+
if ( Set ) OrderedSet.__proto__ = Set;
|
|
5443
|
+
OrderedSet.prototype = Object.create( Set && Set.prototype );
|
|
5297
5444
|
OrderedSet.prototype.constructor = OrderedSet;
|
|
5298
5445
|
|
|
5299
5446
|
OrderedSet.of = function of (/*...values*/) {
|
|
@@ -5311,16 +5458,13 @@ var OrderedSet = (function (Set$$1) {
|
|
|
5311
5458
|
return OrderedSet;
|
|
5312
5459
|
}(Set));
|
|
5313
5460
|
|
|
5314
|
-
function isOrderedSet(maybeOrderedSet) {
|
|
5315
|
-
return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
|
|
5316
|
-
}
|
|
5317
|
-
|
|
5318
5461
|
OrderedSet.isOrderedSet = isOrderedSet;
|
|
5319
5462
|
|
|
5320
5463
|
var OrderedSetPrototype = OrderedSet.prototype;
|
|
5321
|
-
OrderedSetPrototype[
|
|
5464
|
+
OrderedSetPrototype[IS_ORDERED_SYMBOL] = true;
|
|
5322
5465
|
OrderedSetPrototype.zip = IndexedCollectionPrototype.zip;
|
|
5323
5466
|
OrderedSetPrototype.zipWith = IndexedCollectionPrototype.zipWith;
|
|
5467
|
+
OrderedSetPrototype.zipAll = IndexedCollectionPrototype.zipAll;
|
|
5324
5468
|
|
|
5325
5469
|
OrderedSetPrototype.__empty = emptyOrderedSet;
|
|
5326
5470
|
OrderedSetPrototype.__make = makeOrderedSet;
|
|
@@ -5340,11 +5484,33 @@ function emptyOrderedSet() {
|
|
|
5340
5484
|
);
|
|
5341
5485
|
}
|
|
5342
5486
|
|
|
5487
|
+
function throwOnInvalidDefaultValues(defaultValues) {
|
|
5488
|
+
if (isRecord(defaultValues)) {
|
|
5489
|
+
throw new Error(
|
|
5490
|
+
'Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.'
|
|
5491
|
+
);
|
|
5492
|
+
}
|
|
5493
|
+
|
|
5494
|
+
if (isImmutable(defaultValues)) {
|
|
5495
|
+
throw new Error(
|
|
5496
|
+
'Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.'
|
|
5497
|
+
);
|
|
5498
|
+
}
|
|
5499
|
+
|
|
5500
|
+
if (defaultValues === null || typeof defaultValues !== 'object') {
|
|
5501
|
+
throw new Error(
|
|
5502
|
+
'Can not call `Record` with a non-object as default values. Use a plain javascript object instead.'
|
|
5503
|
+
);
|
|
5504
|
+
}
|
|
5505
|
+
}
|
|
5506
|
+
|
|
5343
5507
|
var Record = function Record(defaultValues, name) {
|
|
5344
5508
|
var hasInitialized;
|
|
5345
5509
|
|
|
5510
|
+
throwOnInvalidDefaultValues(defaultValues);
|
|
5511
|
+
|
|
5346
5512
|
var RecordType = function Record(values) {
|
|
5347
|
-
var this$1 = this;
|
|
5513
|
+
var this$1$1 = this;
|
|
5348
5514
|
|
|
5349
5515
|
if (values instanceof RecordType) {
|
|
5350
5516
|
return values;
|
|
@@ -5356,6 +5522,9 @@ var Record = function Record(defaultValues, name) {
|
|
|
5356
5522
|
hasInitialized = true;
|
|
5357
5523
|
var keys = Object.keys(defaultValues);
|
|
5358
5524
|
var indices = (RecordTypePrototype._indices = {});
|
|
5525
|
+
// Deprecated: left to attempt not to break any external code which
|
|
5526
|
+
// relies on a ._name property existing on record instances.
|
|
5527
|
+
// Use Record.getDescriptiveName() instead
|
|
5359
5528
|
RecordTypePrototype._name = name;
|
|
5360
5529
|
RecordTypePrototype._keys = keys;
|
|
5361
5530
|
RecordTypePrototype._defaultValues = defaultValues;
|
|
@@ -5368,7 +5537,7 @@ var Record = function Record(defaultValues, name) {
|
|
|
5368
5537
|
console.warn &&
|
|
5369
5538
|
console.warn(
|
|
5370
5539
|
'Cannot define ' +
|
|
5371
|
-
recordName(this
|
|
5540
|
+
recordName(this) +
|
|
5372
5541
|
' with property "' +
|
|
5373
5542
|
propName +
|
|
5374
5543
|
'" since that property name is part of the Record API.'
|
|
@@ -5381,30 +5550,32 @@ var Record = function Record(defaultValues, name) {
|
|
|
5381
5550
|
}
|
|
5382
5551
|
this.__ownerID = undefined;
|
|
5383
5552
|
this._values = List().withMutations(function (l) {
|
|
5384
|
-
l.setSize(this$1._keys.length);
|
|
5553
|
+
l.setSize(this$1$1._keys.length);
|
|
5385
5554
|
KeyedCollection(values).forEach(function (v, k) {
|
|
5386
|
-
l.set(this$1._indices[k], v === this$1._defaultValues[k] ? undefined : v);
|
|
5555
|
+
l.set(this$1$1._indices[k], v === this$1$1._defaultValues[k] ? undefined : v);
|
|
5387
5556
|
});
|
|
5388
5557
|
});
|
|
5558
|
+
return this;
|
|
5389
5559
|
};
|
|
5390
5560
|
|
|
5391
|
-
var RecordTypePrototype = (RecordType.prototype =
|
|
5392
|
-
RecordPrototype
|
|
5393
|
-
));
|
|
5561
|
+
var RecordTypePrototype = (RecordType.prototype =
|
|
5562
|
+
Object.create(RecordPrototype));
|
|
5394
5563
|
RecordTypePrototype.constructor = RecordType;
|
|
5395
5564
|
|
|
5565
|
+
if (name) {
|
|
5566
|
+
RecordType.displayName = name;
|
|
5567
|
+
}
|
|
5568
|
+
|
|
5396
5569
|
return RecordType;
|
|
5397
5570
|
};
|
|
5398
5571
|
|
|
5399
5572
|
Record.prototype.toString = function toString () {
|
|
5400
|
-
var this$1 = this;
|
|
5401
|
-
|
|
5402
5573
|
var str = recordName(this) + ' { ';
|
|
5403
5574
|
var keys = this._keys;
|
|
5404
5575
|
var k;
|
|
5405
5576
|
for (var i = 0, l = keys.length; i !== l; i++) {
|
|
5406
5577
|
k = keys[i];
|
|
5407
|
-
str += (i ? ', ' : '') + k + ': ' + quoteString(this
|
|
5578
|
+
str += (i ? ', ' : '') + k + ': ' + quoteString(this.get(k));
|
|
5408
5579
|
}
|
|
5409
5580
|
return str + ' }';
|
|
5410
5581
|
};
|
|
@@ -5412,9 +5583,7 @@ Record.prototype.toString = function toString () {
|
|
|
5412
5583
|
Record.prototype.equals = function equals (other) {
|
|
5413
5584
|
return (
|
|
5414
5585
|
this === other ||
|
|
5415
|
-
(other &&
|
|
5416
|
-
this._keys === other._keys &&
|
|
5417
|
-
recordSeq(this).equals(recordSeq(other)))
|
|
5586
|
+
(isRecord(other) && recordSeq(this).equals(recordSeq(other)))
|
|
5418
5587
|
);
|
|
5419
5588
|
};
|
|
5420
5589
|
|
|
@@ -5458,6 +5627,7 @@ Record.prototype.remove = function remove (k) {
|
|
|
5458
5627
|
|
|
5459
5628
|
Record.prototype.clear = function clear () {
|
|
5460
5629
|
var newValues = this._values.clear().setSize(this._keys.length);
|
|
5630
|
+
|
|
5461
5631
|
return this.__ownerID ? this : makeRecord(this, newValues);
|
|
5462
5632
|
};
|
|
5463
5633
|
|
|
@@ -5501,27 +5671,27 @@ Record.prototype.__ensureOwner = function __ensureOwner (ownerID) {
|
|
|
5501
5671
|
Record.isRecord = isRecord;
|
|
5502
5672
|
Record.getDescriptiveName = recordName;
|
|
5503
5673
|
var RecordPrototype = Record.prototype;
|
|
5504
|
-
RecordPrototype[
|
|
5674
|
+
RecordPrototype[IS_RECORD_SYMBOL] = true;
|
|
5505
5675
|
RecordPrototype[DELETE] = RecordPrototype.remove;
|
|
5506
5676
|
RecordPrototype.deleteIn = RecordPrototype.removeIn = deleteIn;
|
|
5507
|
-
RecordPrototype.getIn = getIn
|
|
5677
|
+
RecordPrototype.getIn = getIn;
|
|
5508
5678
|
RecordPrototype.hasIn = CollectionPrototype.hasIn;
|
|
5509
|
-
RecordPrototype.merge = merge;
|
|
5510
|
-
RecordPrototype.mergeWith = mergeWith;
|
|
5679
|
+
RecordPrototype.merge = merge$1;
|
|
5680
|
+
RecordPrototype.mergeWith = mergeWith$1;
|
|
5511
5681
|
RecordPrototype.mergeIn = mergeIn;
|
|
5512
5682
|
RecordPrototype.mergeDeep = mergeDeep;
|
|
5513
5683
|
RecordPrototype.mergeDeepWith = mergeDeepWith;
|
|
5514
5684
|
RecordPrototype.mergeDeepIn = mergeDeepIn;
|
|
5515
|
-
RecordPrototype.setIn = setIn
|
|
5516
|
-
RecordPrototype.update = update
|
|
5517
|
-
RecordPrototype.updateIn = updateIn
|
|
5685
|
+
RecordPrototype.setIn = setIn;
|
|
5686
|
+
RecordPrototype.update = update;
|
|
5687
|
+
RecordPrototype.updateIn = updateIn;
|
|
5518
5688
|
RecordPrototype.withMutations = withMutations;
|
|
5519
5689
|
RecordPrototype.asMutable = asMutable;
|
|
5520
5690
|
RecordPrototype.asImmutable = asImmutable;
|
|
5521
5691
|
RecordPrototype[ITERATOR_SYMBOL] = RecordPrototype.entries;
|
|
5522
5692
|
RecordPrototype.toJSON = RecordPrototype.toObject =
|
|
5523
5693
|
CollectionPrototype.toObject;
|
|
5524
|
-
RecordPrototype.inspect = RecordPrototype.toSource = function() {
|
|
5694
|
+
RecordPrototype.inspect = RecordPrototype.toSource = function () {
|
|
5525
5695
|
return this.toString();
|
|
5526
5696
|
};
|
|
5527
5697
|
|
|
@@ -5533,7 +5703,7 @@ function makeRecord(likeRecord, values, ownerID) {
|
|
|
5533
5703
|
}
|
|
5534
5704
|
|
|
5535
5705
|
function recordName(record) {
|
|
5536
|
-
return record.
|
|
5706
|
+
return record.constructor.displayName || record.constructor.name || 'Record';
|
|
5537
5707
|
}
|
|
5538
5708
|
|
|
5539
5709
|
function recordSeq(record) {
|
|
@@ -5543,13 +5713,13 @@ function recordSeq(record) {
|
|
|
5543
5713
|
function setProp(prototype, name) {
|
|
5544
5714
|
try {
|
|
5545
5715
|
Object.defineProperty(prototype, name, {
|
|
5546
|
-
get: function() {
|
|
5716
|
+
get: function () {
|
|
5547
5717
|
return this.get(name);
|
|
5548
5718
|
},
|
|
5549
|
-
set: function(value) {
|
|
5719
|
+
set: function (value) {
|
|
5550
5720
|
invariant(this.__ownerID, 'Cannot set on an immutable record.');
|
|
5551
5721
|
this.set(name, value);
|
|
5552
|
-
}
|
|
5722
|
+
},
|
|
5553
5723
|
});
|
|
5554
5724
|
} catch (error) {
|
|
5555
5725
|
// Object.defineProperty failed. Probably IE8.
|
|
@@ -5560,7 +5730,7 @@ function setProp(prototype, name) {
|
|
|
5560
5730
|
* Returns a lazy Seq of `value` repeated `times` times. When `times` is
|
|
5561
5731
|
* undefined, returns an infinite sequence of `value`.
|
|
5562
5732
|
*/
|
|
5563
|
-
var Repeat = (function (IndexedSeq
|
|
5733
|
+
var Repeat = /*@__PURE__*/(function (IndexedSeq) {
|
|
5564
5734
|
function Repeat(value, times) {
|
|
5565
5735
|
if (!(this instanceof Repeat)) {
|
|
5566
5736
|
return new Repeat(value, times);
|
|
@@ -5575,8 +5745,8 @@ var Repeat = (function (IndexedSeq$$1) {
|
|
|
5575
5745
|
}
|
|
5576
5746
|
}
|
|
5577
5747
|
|
|
5578
|
-
if ( IndexedSeq
|
|
5579
|
-
Repeat.prototype = Object.create( IndexedSeq
|
|
5748
|
+
if ( IndexedSeq ) Repeat.__proto__ = IndexedSeq;
|
|
5749
|
+
Repeat.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
|
|
5580
5750
|
Repeat.prototype.constructor = Repeat;
|
|
5581
5751
|
|
|
5582
5752
|
Repeat.prototype.toString = function toString () {
|
|
@@ -5623,12 +5793,10 @@ var Repeat = (function (IndexedSeq$$1) {
|
|
|
5623
5793
|
};
|
|
5624
5794
|
|
|
5625
5795
|
Repeat.prototype.__iterate = function __iterate (fn, reverse) {
|
|
5626
|
-
var this$1 = this;
|
|
5627
|
-
|
|
5628
5796
|
var size = this.size;
|
|
5629
5797
|
var i = 0;
|
|
5630
5798
|
while (i !== size) {
|
|
5631
|
-
if (fn(this
|
|
5799
|
+
if (fn(this._value, reverse ? size - ++i : i++, this) === false) {
|
|
5632
5800
|
break;
|
|
5633
5801
|
}
|
|
5634
5802
|
}
|
|
@@ -5636,14 +5804,13 @@ var Repeat = (function (IndexedSeq$$1) {
|
|
|
5636
5804
|
};
|
|
5637
5805
|
|
|
5638
5806
|
Repeat.prototype.__iterator = function __iterator (type, reverse) {
|
|
5639
|
-
var this$1 = this;
|
|
5807
|
+
var this$1$1 = this;
|
|
5640
5808
|
|
|
5641
5809
|
var size = this.size;
|
|
5642
5810
|
var i = 0;
|
|
5643
|
-
return new Iterator(
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
: iteratorValue(type, reverse ? size - ++i : i++, this$1._value); }
|
|
5811
|
+
return new Iterator(function () { return i === size
|
|
5812
|
+
? iteratorDone()
|
|
5813
|
+
: iteratorValue(type, reverse ? size - ++i : i++, this$1$1._value); }
|
|
5647
5814
|
);
|
|
5648
5815
|
};
|
|
5649
5816
|
|
|
@@ -5670,10 +5837,11 @@ function fromJS(value, converter) {
|
|
|
5670
5837
|
}
|
|
5671
5838
|
|
|
5672
5839
|
function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5840
|
+
if (
|
|
5841
|
+
typeof value !== 'string' &&
|
|
5842
|
+
!isImmutable(value) &&
|
|
5843
|
+
(isArrayLike(value) || hasIterator(value) || isPlainObject(value))
|
|
5844
|
+
) {
|
|
5677
5845
|
if (~stack.indexOf(value)) {
|
|
5678
5846
|
throw new TypeError('Cannot convert circular structure to Immutable');
|
|
5679
5847
|
}
|
|
@@ -5682,7 +5850,7 @@ function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
|
|
|
5682
5850
|
var converted = converter.call(
|
|
5683
5851
|
parentValue,
|
|
5684
5852
|
key,
|
|
5685
|
-
|
|
5853
|
+
Seq(value).map(function (v, k) { return fromJSWith(stack, converter, v, k, keyPath, value); }
|
|
5686
5854
|
),
|
|
5687
5855
|
keyPath && keyPath.slice()
|
|
5688
5856
|
);
|
|
@@ -5694,12 +5862,12 @@ function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
|
|
|
5694
5862
|
}
|
|
5695
5863
|
|
|
5696
5864
|
function defaultConverter(k, v) {
|
|
5697
|
-
|
|
5865
|
+
// Effectively the opposite of "Collection.toSeq()"
|
|
5866
|
+
return isIndexed(v) ? v.toList() : isKeyed(v) ? v.toMap() : v.toSet();
|
|
5698
5867
|
}
|
|
5699
5868
|
|
|
5700
|
-
var version = "4.
|
|
5869
|
+
var version = "4.1.0";
|
|
5701
5870
|
|
|
5702
|
-
// Functional read/write API
|
|
5703
5871
|
var Immutable = {
|
|
5704
5872
|
version: version,
|
|
5705
5873
|
|
|
@@ -5730,25 +5898,34 @@ var Immutable = {
|
|
|
5730
5898
|
isAssociative: isAssociative,
|
|
5731
5899
|
isOrdered: isOrdered,
|
|
5732
5900
|
isValueObject: isValueObject,
|
|
5901
|
+
isPlainObject: isPlainObject,
|
|
5902
|
+
isSeq: isSeq,
|
|
5903
|
+
isList: isList,
|
|
5904
|
+
isMap: isMap,
|
|
5905
|
+
isOrderedMap: isOrderedMap,
|
|
5906
|
+
isStack: isStack,
|
|
5907
|
+
isSet: isSet,
|
|
5908
|
+
isOrderedSet: isOrderedSet,
|
|
5909
|
+
isRecord: isRecord,
|
|
5733
5910
|
|
|
5734
5911
|
get: get,
|
|
5735
5912
|
getIn: getIn$1,
|
|
5736
5913
|
has: has,
|
|
5737
5914
|
hasIn: hasIn$1,
|
|
5738
|
-
merge: merge
|
|
5915
|
+
merge: merge,
|
|
5739
5916
|
mergeDeep: mergeDeep$1,
|
|
5740
|
-
mergeWith: mergeWith
|
|
5917
|
+
mergeWith: mergeWith,
|
|
5741
5918
|
mergeDeepWith: mergeDeepWith$1,
|
|
5742
5919
|
remove: remove,
|
|
5743
5920
|
removeIn: removeIn,
|
|
5744
5921
|
set: set,
|
|
5745
5922
|
setIn: setIn$1,
|
|
5746
5923
|
update: update$1,
|
|
5747
|
-
updateIn: updateIn
|
|
5924
|
+
updateIn: updateIn$1,
|
|
5748
5925
|
};
|
|
5749
5926
|
|
|
5750
5927
|
// Note: Iterable is deprecated
|
|
5751
5928
|
var Iterable = Collection;
|
|
5752
5929
|
|
|
5753
|
-
export { version, Collection, Iterable, Seq, Map, OrderedMap, List, Stack, Set, OrderedSet, Record, Range, Repeat, is, fromJS, hash, isImmutable, isCollection, isKeyed, isIndexed, isAssociative, isOrdered, isValueObject, get, getIn$1 as getIn, has, hasIn$1 as hasIn, merge$1 as merge, mergeDeep$1 as mergeDeep, mergeWith$1 as mergeWith, mergeDeepWith$1 as mergeDeepWith, remove, removeIn, set, setIn$1 as setIn, update$1 as update, updateIn };
|
|
5754
5930
|
export default Immutable;
|
|
5931
|
+
export { Collection, Iterable, List, Map, OrderedMap, OrderedSet, Range, Record, Repeat, Seq, Set, Stack, fromJS, get, getIn$1 as getIn, has, hasIn$1 as hasIn, hash, is, isAssociative, isCollection, isImmutable, isIndexed, isKeyed, isList, isMap, isOrdered, isOrderedMap, isOrderedSet, isPlainObject, isRecord, isSeq, isSet, isStack, isValueObject, merge, mergeDeep$1 as mergeDeep, mergeDeepWith$1 as mergeDeepWith, mergeWith, remove, removeIn, set, setIn$1 as setIn, update$1 as update, updateIn$1 as updateIn, version };
|