immutable 4.0.0-rc.10 → 4.0.0-rc.15
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 +174 -100
- package/dist/immutable.d.ts +824 -528
- package/dist/immutable.es.js +626 -509
- package/dist/immutable.js +657 -531
- package/dist/immutable.js.flow +937 -264
- package/dist/immutable.min.js +53 -36
- package/package.json +7 -11
- 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 -5333
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.
|
|
@@ -84,12 +99,12 @@ function resolveIndex(index, size, defaultIndex) {
|
|
|
84
99
|
return index === undefined
|
|
85
100
|
? defaultIndex
|
|
86
101
|
: isNeg(index)
|
|
87
|
-
|
|
88
|
-
|
|
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,7 +112,6 @@ function isNeg(value) {
|
|
|
97
112
|
return value < 0 || (value === 0 && 1 / value === -Infinity);
|
|
98
113
|
}
|
|
99
114
|
|
|
100
|
-
// Note: value is unchanged to not break immutable-devtools.
|
|
101
115
|
var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
|
|
102
116
|
|
|
103
117
|
function isCollection(maybeCollection) {
|
|
@@ -124,7 +138,7 @@ var Collection = function Collection(value) {
|
|
|
124
138
|
return isCollection(value) ? value : Seq(value);
|
|
125
139
|
};
|
|
126
140
|
|
|
127
|
-
var KeyedCollection = (function (Collection) {
|
|
141
|
+
var KeyedCollection = /*@__PURE__*/(function (Collection) {
|
|
128
142
|
function KeyedCollection(value) {
|
|
129
143
|
return isKeyed(value) ? value : KeyedSeq(value);
|
|
130
144
|
}
|
|
@@ -136,7 +150,7 @@ var KeyedCollection = (function (Collection) {
|
|
|
136
150
|
return KeyedCollection;
|
|
137
151
|
}(Collection));
|
|
138
152
|
|
|
139
|
-
var IndexedCollection = (function (Collection) {
|
|
153
|
+
var IndexedCollection = /*@__PURE__*/(function (Collection) {
|
|
140
154
|
function IndexedCollection(value) {
|
|
141
155
|
return isIndexed(value) ? value : IndexedSeq(value);
|
|
142
156
|
}
|
|
@@ -148,7 +162,7 @@ var IndexedCollection = (function (Collection) {
|
|
|
148
162
|
return IndexedCollection;
|
|
149
163
|
}(Collection));
|
|
150
164
|
|
|
151
|
-
var SetCollection = (function (Collection) {
|
|
165
|
+
var SetCollection = /*@__PURE__*/(function (Collection) {
|
|
152
166
|
function SetCollection(value) {
|
|
153
167
|
return isCollection(value) && !isAssociative(value) ? value : SetSeq(value);
|
|
154
168
|
}
|
|
@@ -207,10 +221,10 @@ Iterator.KEYS = ITERATE_KEYS;
|
|
|
207
221
|
Iterator.VALUES = ITERATE_VALUES;
|
|
208
222
|
Iterator.ENTRIES = ITERATE_ENTRIES;
|
|
209
223
|
|
|
210
|
-
Iterator.prototype.inspect = Iterator.prototype.toSource = function() {
|
|
224
|
+
Iterator.prototype.inspect = Iterator.prototype.toSource = function () {
|
|
211
225
|
return this.toString();
|
|
212
226
|
};
|
|
213
|
-
Iterator.prototype[ITERATOR_SYMBOL] = function() {
|
|
227
|
+
Iterator.prototype[ITERATOR_SYMBOL] = function () {
|
|
214
228
|
return this;
|
|
215
229
|
};
|
|
216
230
|
|
|
@@ -230,6 +244,11 @@ function iteratorDone() {
|
|
|
230
244
|
}
|
|
231
245
|
|
|
232
246
|
function hasIterator(maybeIterable) {
|
|
247
|
+
if (Array.isArray(maybeIterable)) {
|
|
248
|
+
// IE11 trick as it does not support `Symbol.iterator`
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
|
|
233
252
|
return !!getIteratorFn(maybeIterable);
|
|
234
253
|
}
|
|
235
254
|
|
|
@@ -252,6 +271,16 @@ function getIteratorFn(iterable) {
|
|
|
252
271
|
}
|
|
253
272
|
}
|
|
254
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
|
+
|
|
255
284
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
256
285
|
|
|
257
286
|
function isArrayLike(value) {
|
|
@@ -273,17 +302,17 @@ function isArrayLike(value) {
|
|
|
273
302
|
);
|
|
274
303
|
}
|
|
275
304
|
|
|
276
|
-
var Seq = (function (Collection
|
|
305
|
+
var Seq = /*@__PURE__*/(function (Collection) {
|
|
277
306
|
function Seq(value) {
|
|
278
307
|
return value === null || value === undefined
|
|
279
308
|
? emptySequence()
|
|
280
309
|
: isImmutable(value)
|
|
281
|
-
|
|
282
|
-
|
|
310
|
+
? value.toSeq()
|
|
311
|
+
: seqFromValue(value);
|
|
283
312
|
}
|
|
284
313
|
|
|
285
|
-
if ( Collection
|
|
286
|
-
Seq.prototype = Object.create( Collection
|
|
314
|
+
if ( Collection ) Seq.__proto__ = Collection;
|
|
315
|
+
Seq.prototype = Object.create( Collection && Collection.prototype );
|
|
287
316
|
Seq.prototype.constructor = Seq;
|
|
288
317
|
|
|
289
318
|
Seq.prototype.toSeq = function toSeq () {
|
|
@@ -305,15 +334,13 @@ var Seq = (function (Collection$$1) {
|
|
|
305
334
|
// abstract __iterateUncached(fn, reverse)
|
|
306
335
|
|
|
307
336
|
Seq.prototype.__iterate = function __iterate (fn, reverse) {
|
|
308
|
-
var this$1 = this;
|
|
309
|
-
|
|
310
337
|
var cache = this._cache;
|
|
311
338
|
if (cache) {
|
|
312
339
|
var size = cache.length;
|
|
313
340
|
var i = 0;
|
|
314
341
|
while (i !== size) {
|
|
315
342
|
var entry = cache[reverse ? size - ++i : i++];
|
|
316
|
-
if (fn(entry[1], entry[0], this
|
|
343
|
+
if (fn(entry[1], entry[0], this) === false) {
|
|
317
344
|
break;
|
|
318
345
|
}
|
|
319
346
|
}
|
|
@@ -343,17 +370,17 @@ var Seq = (function (Collection$$1) {
|
|
|
343
370
|
return Seq;
|
|
344
371
|
}(Collection));
|
|
345
372
|
|
|
346
|
-
var KeyedSeq = (function (Seq) {
|
|
373
|
+
var KeyedSeq = /*@__PURE__*/(function (Seq) {
|
|
347
374
|
function KeyedSeq(value) {
|
|
348
375
|
return value === null || value === undefined
|
|
349
376
|
? emptySequence().toKeyedSeq()
|
|
350
377
|
: isCollection(value)
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
378
|
+
? isKeyed(value)
|
|
379
|
+
? value.toSeq()
|
|
380
|
+
: value.fromEntrySeq()
|
|
381
|
+
: isRecord(value)
|
|
382
|
+
? value.toSeq()
|
|
383
|
+
: keyedSeqFromValue(value);
|
|
357
384
|
}
|
|
358
385
|
|
|
359
386
|
if ( Seq ) KeyedSeq.__proto__ = Seq;
|
|
@@ -367,17 +394,17 @@ var KeyedSeq = (function (Seq) {
|
|
|
367
394
|
return KeyedSeq;
|
|
368
395
|
}(Seq));
|
|
369
396
|
|
|
370
|
-
var IndexedSeq = (function (Seq) {
|
|
397
|
+
var IndexedSeq = /*@__PURE__*/(function (Seq) {
|
|
371
398
|
function IndexedSeq(value) {
|
|
372
399
|
return value === null || value === undefined
|
|
373
400
|
? emptySequence()
|
|
374
401
|
: isCollection(value)
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
402
|
+
? isKeyed(value)
|
|
403
|
+
? value.entrySeq()
|
|
404
|
+
: value.toIndexedSeq()
|
|
405
|
+
: isRecord(value)
|
|
406
|
+
? value.toSeq().entrySeq()
|
|
407
|
+
: indexedSeqFromValue(value);
|
|
381
408
|
}
|
|
382
409
|
|
|
383
410
|
if ( Seq ) IndexedSeq.__proto__ = Seq;
|
|
@@ -399,11 +426,10 @@ var IndexedSeq = (function (Seq) {
|
|
|
399
426
|
return IndexedSeq;
|
|
400
427
|
}(Seq));
|
|
401
428
|
|
|
402
|
-
var SetSeq = (function (Seq) {
|
|
429
|
+
var SetSeq = /*@__PURE__*/(function (Seq) {
|
|
403
430
|
function SetSeq(value) {
|
|
404
|
-
return (
|
|
405
|
-
? value
|
|
406
|
-
: IndexedSeq(value)
|
|
431
|
+
return (
|
|
432
|
+
isCollection(value) && !isAssociative(value) ? value : IndexedSeq(value)
|
|
407
433
|
).toSetSeq();
|
|
408
434
|
}
|
|
409
435
|
|
|
@@ -431,7 +457,7 @@ Seq.prototype[IS_SEQ_SYMBOL] = true;
|
|
|
431
457
|
|
|
432
458
|
// #pragma Root Sequences
|
|
433
459
|
|
|
434
|
-
var ArraySeq = (function (IndexedSeq) {
|
|
460
|
+
var ArraySeq = /*@__PURE__*/(function (IndexedSeq) {
|
|
435
461
|
function ArraySeq(array) {
|
|
436
462
|
this._array = array;
|
|
437
463
|
this.size = array.length;
|
|
@@ -446,14 +472,12 @@ var ArraySeq = (function (IndexedSeq) {
|
|
|
446
472
|
};
|
|
447
473
|
|
|
448
474
|
ArraySeq.prototype.__iterate = function __iterate (fn, reverse) {
|
|
449
|
-
var this$1 = this;
|
|
450
|
-
|
|
451
475
|
var array = this._array;
|
|
452
476
|
var size = array.length;
|
|
453
477
|
var i = 0;
|
|
454
478
|
while (i !== size) {
|
|
455
479
|
var ii = reverse ? size - ++i : i++;
|
|
456
|
-
if (fn(array[ii], ii, this
|
|
480
|
+
if (fn(array[ii], ii, this) === false) {
|
|
457
481
|
break;
|
|
458
482
|
}
|
|
459
483
|
}
|
|
@@ -476,7 +500,7 @@ var ArraySeq = (function (IndexedSeq) {
|
|
|
476
500
|
return ArraySeq;
|
|
477
501
|
}(IndexedSeq));
|
|
478
502
|
|
|
479
|
-
var ObjectSeq = (function (KeyedSeq) {
|
|
503
|
+
var ObjectSeq = /*@__PURE__*/(function (KeyedSeq) {
|
|
480
504
|
function ObjectSeq(object) {
|
|
481
505
|
var keys = Object.keys(object);
|
|
482
506
|
this._object = object;
|
|
@@ -500,15 +524,13 @@ var ObjectSeq = (function (KeyedSeq) {
|
|
|
500
524
|
};
|
|
501
525
|
|
|
502
526
|
ObjectSeq.prototype.__iterate = function __iterate (fn, reverse) {
|
|
503
|
-
var this$1 = this;
|
|
504
|
-
|
|
505
527
|
var object = this._object;
|
|
506
528
|
var keys = this._keys;
|
|
507
529
|
var size = keys.length;
|
|
508
530
|
var i = 0;
|
|
509
531
|
while (i !== size) {
|
|
510
532
|
var key = keys[reverse ? size - ++i : i++];
|
|
511
|
-
if (fn(object[key], key, this
|
|
533
|
+
if (fn(object[key], key, this) === false) {
|
|
512
534
|
break;
|
|
513
535
|
}
|
|
514
536
|
}
|
|
@@ -533,7 +555,7 @@ var ObjectSeq = (function (KeyedSeq) {
|
|
|
533
555
|
}(KeyedSeq));
|
|
534
556
|
ObjectSeq.prototype[IS_ORDERED_SYMBOL] = true;
|
|
535
557
|
|
|
536
|
-
var CollectionSeq = (function (IndexedSeq) {
|
|
558
|
+
var CollectionSeq = /*@__PURE__*/(function (IndexedSeq) {
|
|
537
559
|
function CollectionSeq(collection) {
|
|
538
560
|
this._collection = collection;
|
|
539
561
|
this.size = collection.length || collection.size;
|
|
@@ -544,8 +566,6 @@ var CollectionSeq = (function (IndexedSeq) {
|
|
|
544
566
|
CollectionSeq.prototype.constructor = CollectionSeq;
|
|
545
567
|
|
|
546
568
|
CollectionSeq.prototype.__iterateUncached = function __iterateUncached (fn, reverse) {
|
|
547
|
-
var this$1 = this;
|
|
548
|
-
|
|
549
569
|
if (reverse) {
|
|
550
570
|
return this.cacheResult().__iterate(fn, reverse);
|
|
551
571
|
}
|
|
@@ -555,7 +575,7 @@ var CollectionSeq = (function (IndexedSeq) {
|
|
|
555
575
|
if (isIterator(iterator)) {
|
|
556
576
|
var step;
|
|
557
577
|
while (!(step = iterator.next()).done) {
|
|
558
|
-
if (fn(step.value, iterations++, this
|
|
578
|
+
if (fn(step.value, iterations++, this) === false) {
|
|
559
579
|
break;
|
|
560
580
|
}
|
|
561
581
|
}
|
|
@@ -591,11 +611,7 @@ function emptySequence() {
|
|
|
591
611
|
}
|
|
592
612
|
|
|
593
613
|
function keyedSeqFromValue(value) {
|
|
594
|
-
var seq =
|
|
595
|
-
? new ArraySeq(value)
|
|
596
|
-
: hasIterator(value)
|
|
597
|
-
? new CollectionSeq(value)
|
|
598
|
-
: undefined;
|
|
614
|
+
var seq = maybeIndexedSeqFromValue(value);
|
|
599
615
|
if (seq) {
|
|
600
616
|
return seq.fromEntrySeq();
|
|
601
617
|
}
|
|
@@ -621,7 +637,11 @@ function indexedSeqFromValue(value) {
|
|
|
621
637
|
function seqFromValue(value) {
|
|
622
638
|
var seq = maybeIndexedSeqFromValue(value);
|
|
623
639
|
if (seq) {
|
|
624
|
-
return
|
|
640
|
+
return isEntriesIterable(value)
|
|
641
|
+
? seq.fromEntrySeq()
|
|
642
|
+
: isKeysIterable(value)
|
|
643
|
+
? seq.toSetSeq()
|
|
644
|
+
: seq;
|
|
625
645
|
}
|
|
626
646
|
if (typeof value === 'object') {
|
|
627
647
|
return new ObjectSeq(value);
|
|
@@ -635,8 +655,8 @@ function maybeIndexedSeqFromValue(value) {
|
|
|
635
655
|
return isArrayLike(value)
|
|
636
656
|
? new ArraySeq(value)
|
|
637
657
|
: hasIterator(value)
|
|
638
|
-
|
|
639
|
-
|
|
658
|
+
? new CollectionSeq(value)
|
|
659
|
+
: undefined;
|
|
640
660
|
}
|
|
641
661
|
|
|
642
662
|
var IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';
|
|
@@ -758,50 +778,67 @@ function smi(i32) {
|
|
|
758
778
|
return ((i32 >>> 1) & 0x40000000) | (i32 & 0xbfffffff);
|
|
759
779
|
}
|
|
760
780
|
|
|
781
|
+
var defaultValueOf = Object.prototype.valueOf;
|
|
782
|
+
|
|
761
783
|
function hash(o) {
|
|
762
|
-
if (o
|
|
763
|
-
return
|
|
764
|
-
}
|
|
765
|
-
if (typeof o.valueOf === 'function') {
|
|
766
|
-
o = o.valueOf();
|
|
767
|
-
if (o === false || o === null || o === undefined) {
|
|
768
|
-
return 0;
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
if (o === true) {
|
|
772
|
-
return 1;
|
|
773
|
-
}
|
|
774
|
-
var type = typeof o;
|
|
775
|
-
if (type === 'number') {
|
|
776
|
-
if (o !== o || o === Infinity) {
|
|
777
|
-
return 0;
|
|
778
|
-
}
|
|
779
|
-
var h = o | 0;
|
|
780
|
-
if (h !== o) {
|
|
781
|
-
h ^= o * 0xffffffff;
|
|
782
|
-
}
|
|
783
|
-
while (o > 0xffffffff) {
|
|
784
|
-
o /= 0xffffffff;
|
|
785
|
-
h ^= o;
|
|
786
|
-
}
|
|
787
|
-
return smi(h);
|
|
788
|
-
}
|
|
789
|
-
if (type === 'string') {
|
|
790
|
-
return o.length > STRING_HASH_CACHE_MIN_STRLEN
|
|
791
|
-
? cachedHashString(o)
|
|
792
|
-
: hashString(o);
|
|
784
|
+
if (o == null) {
|
|
785
|
+
return hashNullish(o);
|
|
793
786
|
}
|
|
787
|
+
|
|
794
788
|
if (typeof o.hashCode === 'function') {
|
|
795
789
|
// Drop any high bits from accidentally long hash codes.
|
|
796
|
-
return smi(o.hashCode());
|
|
790
|
+
return smi(o.hashCode(o));
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
var v = valueOf(o);
|
|
794
|
+
|
|
795
|
+
if (v == null) {
|
|
796
|
+
return hashNullish(v);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
switch (typeof v) {
|
|
800
|
+
case 'boolean':
|
|
801
|
+
// The hash values for built-in constants are a 1 value for each 5-byte
|
|
802
|
+
// shift region expect for the first, which encodes the value. This
|
|
803
|
+
// reduces the odds of a hash collision for these common values.
|
|
804
|
+
return v ? 0x42108421 : 0x42108420;
|
|
805
|
+
case 'number':
|
|
806
|
+
return hashNumber(v);
|
|
807
|
+
case 'string':
|
|
808
|
+
return v.length > STRING_HASH_CACHE_MIN_STRLEN
|
|
809
|
+
? cachedHashString(v)
|
|
810
|
+
: hashString(v);
|
|
811
|
+
case 'object':
|
|
812
|
+
case 'function':
|
|
813
|
+
return hashJSObj(v);
|
|
814
|
+
case 'symbol':
|
|
815
|
+
return hashSymbol(v);
|
|
816
|
+
default:
|
|
817
|
+
if (typeof v.toString === 'function') {
|
|
818
|
+
return hashString(v.toString());
|
|
819
|
+
}
|
|
820
|
+
throw new Error('Value type ' + typeof v + ' cannot be hashed.');
|
|
797
821
|
}
|
|
798
|
-
|
|
799
|
-
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
function hashNullish(nullish) {
|
|
825
|
+
return nullish === null ? 0x42108422 : /* undefined */ 0x42108423;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
// Compress arbitrarily large numbers into smi hashes.
|
|
829
|
+
function hashNumber(n) {
|
|
830
|
+
if (n !== n || n === Infinity) {
|
|
831
|
+
return 0;
|
|
832
|
+
}
|
|
833
|
+
var hash = n | 0;
|
|
834
|
+
if (hash !== n) {
|
|
835
|
+
hash ^= n * 0xffffffff;
|
|
800
836
|
}
|
|
801
|
-
|
|
802
|
-
|
|
837
|
+
while (n > 0xffffffff) {
|
|
838
|
+
n /= 0xffffffff;
|
|
839
|
+
hash ^= n;
|
|
803
840
|
}
|
|
804
|
-
|
|
841
|
+
return smi(hash);
|
|
805
842
|
}
|
|
806
843
|
|
|
807
844
|
function cachedHashString(string) {
|
|
@@ -833,6 +870,19 @@ function hashString(string) {
|
|
|
833
870
|
return smi(hashed);
|
|
834
871
|
}
|
|
835
872
|
|
|
873
|
+
function hashSymbol(sym) {
|
|
874
|
+
var hashed = symbolMap[sym];
|
|
875
|
+
if (hashed !== undefined) {
|
|
876
|
+
return hashed;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
hashed = nextHash();
|
|
880
|
+
|
|
881
|
+
symbolMap[sym] = hashed;
|
|
882
|
+
|
|
883
|
+
return hashed;
|
|
884
|
+
}
|
|
885
|
+
|
|
836
886
|
function hashJSObj(obj) {
|
|
837
887
|
var hashed;
|
|
838
888
|
if (usingWeakMap) {
|
|
@@ -859,10 +909,7 @@ function hashJSObj(obj) {
|
|
|
859
909
|
}
|
|
860
910
|
}
|
|
861
911
|
|
|
862
|
-
hashed =
|
|
863
|
-
if (objHashUID & 0x40000000) {
|
|
864
|
-
objHashUID = 0;
|
|
865
|
-
}
|
|
912
|
+
hashed = nextHash();
|
|
866
913
|
|
|
867
914
|
if (usingWeakMap) {
|
|
868
915
|
weakMap.set(obj, hashed);
|
|
@@ -883,7 +930,7 @@ function hashJSObj(obj) {
|
|
|
883
930
|
// we'll hijack one of the less-used non-enumerable properties to
|
|
884
931
|
// save our hash on it. Since this is a function it will not show up in
|
|
885
932
|
// `JSON.stringify` which is what we want.
|
|
886
|
-
obj.propertyIsEnumerable = function() {
|
|
933
|
+
obj.propertyIsEnumerable = function () {
|
|
887
934
|
return this.constructor.prototype.propertyIsEnumerable.apply(
|
|
888
935
|
this,
|
|
889
936
|
arguments
|
|
@@ -907,7 +954,7 @@ function hashJSObj(obj) {
|
|
|
907
954
|
var isExtensible = Object.isExtensible;
|
|
908
955
|
|
|
909
956
|
// True if Object.defineProperty works as expected. IE8 fails this test.
|
|
910
|
-
var canDefineProperty = (function() {
|
|
957
|
+
var canDefineProperty = (function () {
|
|
911
958
|
try {
|
|
912
959
|
Object.defineProperty({}, '@', {});
|
|
913
960
|
return true;
|
|
@@ -929,6 +976,20 @@ function getIENodeHash(node) {
|
|
|
929
976
|
}
|
|
930
977
|
}
|
|
931
978
|
|
|
979
|
+
function valueOf(obj) {
|
|
980
|
+
return obj.valueOf !== defaultValueOf && typeof obj.valueOf === 'function'
|
|
981
|
+
? obj.valueOf(obj)
|
|
982
|
+
: obj;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
function nextHash() {
|
|
986
|
+
var nextHash = ++_objHashUID;
|
|
987
|
+
if (_objHashUID & 0x40000000) {
|
|
988
|
+
_objHashUID = 0;
|
|
989
|
+
}
|
|
990
|
+
return nextHash;
|
|
991
|
+
}
|
|
992
|
+
|
|
932
993
|
// If possible, use a WeakMap.
|
|
933
994
|
var usingWeakMap = typeof WeakMap === 'function';
|
|
934
995
|
var weakMap;
|
|
@@ -936,7 +997,9 @@ if (usingWeakMap) {
|
|
|
936
997
|
weakMap = new WeakMap();
|
|
937
998
|
}
|
|
938
999
|
|
|
939
|
-
var
|
|
1000
|
+
var symbolMap = Object.create(null);
|
|
1001
|
+
|
|
1002
|
+
var _objHashUID = 0;
|
|
940
1003
|
|
|
941
1004
|
var UID_HASH_KEY = '__immutablehash__';
|
|
942
1005
|
if (typeof Symbol === 'function') {
|
|
@@ -948,15 +1011,15 @@ var STRING_HASH_CACHE_MAX_SIZE = 255;
|
|
|
948
1011
|
var STRING_HASH_CACHE_SIZE = 0;
|
|
949
1012
|
var stringHashCache = {};
|
|
950
1013
|
|
|
951
|
-
var ToKeyedSequence = (function (KeyedSeq
|
|
1014
|
+
var ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq) {
|
|
952
1015
|
function ToKeyedSequence(indexed, useKeys) {
|
|
953
1016
|
this._iter = indexed;
|
|
954
1017
|
this._useKeys = useKeys;
|
|
955
1018
|
this.size = indexed.size;
|
|
956
1019
|
}
|
|
957
1020
|
|
|
958
|
-
if ( KeyedSeq
|
|
959
|
-
ToKeyedSequence.prototype = Object.create( KeyedSeq
|
|
1021
|
+
if ( KeyedSeq ) ToKeyedSequence.__proto__ = KeyedSeq;
|
|
1022
|
+
ToKeyedSequence.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
|
|
960
1023
|
ToKeyedSequence.prototype.constructor = ToKeyedSequence;
|
|
961
1024
|
|
|
962
1025
|
ToKeyedSequence.prototype.get = function get (key, notSetValue) {
|
|
@@ -972,29 +1035,29 @@ var ToKeyedSequence = (function (KeyedSeq$$1) {
|
|
|
972
1035
|
};
|
|
973
1036
|
|
|
974
1037
|
ToKeyedSequence.prototype.reverse = function reverse () {
|
|
975
|
-
var this$1 = this;
|
|
1038
|
+
var this$1$1 = this;
|
|
976
1039
|
|
|
977
1040
|
var reversedSequence = reverseFactory(this, true);
|
|
978
1041
|
if (!this._useKeys) {
|
|
979
|
-
reversedSequence.valueSeq = function () { return this$1._iter.toSeq().reverse(); };
|
|
1042
|
+
reversedSequence.valueSeq = function () { return this$1$1._iter.toSeq().reverse(); };
|
|
980
1043
|
}
|
|
981
1044
|
return reversedSequence;
|
|
982
1045
|
};
|
|
983
1046
|
|
|
984
1047
|
ToKeyedSequence.prototype.map = function map (mapper, context) {
|
|
985
|
-
var this$1 = this;
|
|
1048
|
+
var this$1$1 = this;
|
|
986
1049
|
|
|
987
1050
|
var mappedSequence = mapFactory(this, mapper, context);
|
|
988
1051
|
if (!this._useKeys) {
|
|
989
|
-
mappedSequence.valueSeq = function () { return this$1._iter.toSeq().map(mapper, context); };
|
|
1052
|
+
mappedSequence.valueSeq = function () { return this$1$1._iter.toSeq().map(mapper, context); };
|
|
990
1053
|
}
|
|
991
1054
|
return mappedSequence;
|
|
992
1055
|
};
|
|
993
1056
|
|
|
994
1057
|
ToKeyedSequence.prototype.__iterate = function __iterate (fn, reverse) {
|
|
995
|
-
var this$1 = this;
|
|
1058
|
+
var this$1$1 = this;
|
|
996
1059
|
|
|
997
|
-
return this._iter.__iterate(function (v, k) { return fn(v, k, this$1); }, reverse);
|
|
1060
|
+
return this._iter.__iterate(function (v, k) { return fn(v, k, this$1$1); }, reverse);
|
|
998
1061
|
};
|
|
999
1062
|
|
|
1000
1063
|
ToKeyedSequence.prototype.__iterator = function __iterator (type, reverse) {
|
|
@@ -1005,14 +1068,14 @@ var ToKeyedSequence = (function (KeyedSeq$$1) {
|
|
|
1005
1068
|
}(KeyedSeq));
|
|
1006
1069
|
ToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true;
|
|
1007
1070
|
|
|
1008
|
-
var ToIndexedSequence = (function (IndexedSeq
|
|
1071
|
+
var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq) {
|
|
1009
1072
|
function ToIndexedSequence(iter) {
|
|
1010
1073
|
this._iter = iter;
|
|
1011
1074
|
this.size = iter.size;
|
|
1012
1075
|
}
|
|
1013
1076
|
|
|
1014
|
-
if ( IndexedSeq
|
|
1015
|
-
ToIndexedSequence.prototype = Object.create( IndexedSeq
|
|
1077
|
+
if ( IndexedSeq ) ToIndexedSequence.__proto__ = IndexedSeq;
|
|
1078
|
+
ToIndexedSequence.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
|
|
1016
1079
|
ToIndexedSequence.prototype.constructor = ToIndexedSequence;
|
|
1017
1080
|
|
|
1018
1081
|
ToIndexedSequence.prototype.includes = function includes (value) {
|
|
@@ -1020,18 +1083,18 @@ var ToIndexedSequence = (function (IndexedSeq$$1) {
|
|
|
1020
1083
|
};
|
|
1021
1084
|
|
|
1022
1085
|
ToIndexedSequence.prototype.__iterate = function __iterate (fn, reverse) {
|
|
1023
|
-
var this$1 = this;
|
|
1086
|
+
var this$1$1 = this;
|
|
1024
1087
|
|
|
1025
1088
|
var i = 0;
|
|
1026
1089
|
reverse && ensureSize(this);
|
|
1027
1090
|
return this._iter.__iterate(
|
|
1028
|
-
function (v) { return fn(v, reverse ? this$1.size - ++i : i++, this$1); },
|
|
1091
|
+
function (v) { return fn(v, reverse ? this$1$1.size - ++i : i++, this$1$1); },
|
|
1029
1092
|
reverse
|
|
1030
1093
|
);
|
|
1031
1094
|
};
|
|
1032
1095
|
|
|
1033
1096
|
ToIndexedSequence.prototype.__iterator = function __iterator (type, reverse) {
|
|
1034
|
-
var this$1 = this;
|
|
1097
|
+
var this$1$1 = this;
|
|
1035
1098
|
|
|
1036
1099
|
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
|
|
1037
1100
|
var i = 0;
|
|
@@ -1042,7 +1105,7 @@ var ToIndexedSequence = (function (IndexedSeq$$1) {
|
|
|
1042
1105
|
? step
|
|
1043
1106
|
: iteratorValue(
|
|
1044
1107
|
type,
|
|
1045
|
-
reverse ? this$1.size - ++i : i++,
|
|
1108
|
+
reverse ? this$1$1.size - ++i : i++,
|
|
1046
1109
|
step.value,
|
|
1047
1110
|
step
|
|
1048
1111
|
);
|
|
@@ -1052,14 +1115,14 @@ var ToIndexedSequence = (function (IndexedSeq$$1) {
|
|
|
1052
1115
|
return ToIndexedSequence;
|
|
1053
1116
|
}(IndexedSeq));
|
|
1054
1117
|
|
|
1055
|
-
var ToSetSequence = (function (SetSeq
|
|
1118
|
+
var ToSetSequence = /*@__PURE__*/(function (SetSeq) {
|
|
1056
1119
|
function ToSetSequence(iter) {
|
|
1057
1120
|
this._iter = iter;
|
|
1058
1121
|
this.size = iter.size;
|
|
1059
1122
|
}
|
|
1060
1123
|
|
|
1061
|
-
if ( SetSeq
|
|
1062
|
-
ToSetSequence.prototype = Object.create( SetSeq
|
|
1124
|
+
if ( SetSeq ) ToSetSequence.__proto__ = SetSeq;
|
|
1125
|
+
ToSetSequence.prototype = Object.create( SetSeq && SetSeq.prototype );
|
|
1063
1126
|
ToSetSequence.prototype.constructor = ToSetSequence;
|
|
1064
1127
|
|
|
1065
1128
|
ToSetSequence.prototype.has = function has (key) {
|
|
@@ -1067,9 +1130,9 @@ var ToSetSequence = (function (SetSeq$$1) {
|
|
|
1067
1130
|
};
|
|
1068
1131
|
|
|
1069
1132
|
ToSetSequence.prototype.__iterate = function __iterate (fn, reverse) {
|
|
1070
|
-
var this$1 = this;
|
|
1133
|
+
var this$1$1 = this;
|
|
1071
1134
|
|
|
1072
|
-
return this._iter.__iterate(function (v) { return fn(v, v, this$1); }, reverse);
|
|
1135
|
+
return this._iter.__iterate(function (v) { return fn(v, v, this$1$1); }, reverse);
|
|
1073
1136
|
};
|
|
1074
1137
|
|
|
1075
1138
|
ToSetSequence.prototype.__iterator = function __iterator (type, reverse) {
|
|
@@ -1085,14 +1148,14 @@ var ToSetSequence = (function (SetSeq$$1) {
|
|
|
1085
1148
|
return ToSetSequence;
|
|
1086
1149
|
}(SetSeq));
|
|
1087
1150
|
|
|
1088
|
-
var FromEntriesSequence = (function (KeyedSeq
|
|
1151
|
+
var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq) {
|
|
1089
1152
|
function FromEntriesSequence(entries) {
|
|
1090
1153
|
this._iter = entries;
|
|
1091
1154
|
this.size = entries.size;
|
|
1092
1155
|
}
|
|
1093
1156
|
|
|
1094
|
-
if ( KeyedSeq
|
|
1095
|
-
FromEntriesSequence.prototype = Object.create( KeyedSeq
|
|
1157
|
+
if ( KeyedSeq ) FromEntriesSequence.__proto__ = KeyedSeq;
|
|
1158
|
+
FromEntriesSequence.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
|
|
1096
1159
|
FromEntriesSequence.prototype.constructor = FromEntriesSequence;
|
|
1097
1160
|
|
|
1098
1161
|
FromEntriesSequence.prototype.entrySeq = function entrySeq () {
|
|
@@ -1100,7 +1163,7 @@ var FromEntriesSequence = (function (KeyedSeq$$1) {
|
|
|
1100
1163
|
};
|
|
1101
1164
|
|
|
1102
1165
|
FromEntriesSequence.prototype.__iterate = function __iterate (fn, reverse) {
|
|
1103
|
-
var this$1 = this;
|
|
1166
|
+
var this$1$1 = this;
|
|
1104
1167
|
|
|
1105
1168
|
return this._iter.__iterate(function (entry) {
|
|
1106
1169
|
// Check if entry exists first so array access doesn't throw for holes
|
|
@@ -1111,7 +1174,7 @@ var FromEntriesSequence = (function (KeyedSeq$$1) {
|
|
|
1111
1174
|
return fn(
|
|
1112
1175
|
indexedCollection ? entry.get(1) : entry[1],
|
|
1113
1176
|
indexedCollection ? entry.get(0) : entry[0],
|
|
1114
|
-
this$1
|
|
1177
|
+
this$1$1
|
|
1115
1178
|
);
|
|
1116
1179
|
}
|
|
1117
1180
|
}, reverse);
|
|
@@ -1145,14 +1208,18 @@ var FromEntriesSequence = (function (KeyedSeq$$1) {
|
|
|
1145
1208
|
return FromEntriesSequence;
|
|
1146
1209
|
}(KeyedSeq));
|
|
1147
1210
|
|
|
1148
|
-
ToIndexedSequence.prototype.cacheResult =
|
|
1211
|
+
ToIndexedSequence.prototype.cacheResult =
|
|
1212
|
+
ToKeyedSequence.prototype.cacheResult =
|
|
1213
|
+
ToSetSequence.prototype.cacheResult =
|
|
1214
|
+
FromEntriesSequence.prototype.cacheResult =
|
|
1215
|
+
cacheResultThrough;
|
|
1149
1216
|
|
|
1150
1217
|
function flipFactory(collection) {
|
|
1151
1218
|
var flipSequence = makeSequence(collection);
|
|
1152
1219
|
flipSequence._iter = collection;
|
|
1153
1220
|
flipSequence.size = collection.size;
|
|
1154
1221
|
flipSequence.flip = function () { return collection; };
|
|
1155
|
-
flipSequence.reverse = function() {
|
|
1222
|
+
flipSequence.reverse = function () {
|
|
1156
1223
|
var reversedSequence = collection.reverse.apply(this); // super.reverse()
|
|
1157
1224
|
reversedSequence.flip = function () { return collection.reverse(); };
|
|
1158
1225
|
return reversedSequence;
|
|
@@ -1160,12 +1227,12 @@ function flipFactory(collection) {
|
|
|
1160
1227
|
flipSequence.has = function (key) { return collection.includes(key); };
|
|
1161
1228
|
flipSequence.includes = function (key) { return collection.has(key); };
|
|
1162
1229
|
flipSequence.cacheResult = cacheResultThrough;
|
|
1163
|
-
flipSequence.__iterateUncached = function(fn, reverse) {
|
|
1164
|
-
var this$1 = this;
|
|
1230
|
+
flipSequence.__iterateUncached = function (fn, reverse) {
|
|
1231
|
+
var this$1$1 = this;
|
|
1165
1232
|
|
|
1166
|
-
return collection.__iterate(function (v, k) { return fn(k, v, this$1) !== false; }, reverse);
|
|
1233
|
+
return collection.__iterate(function (v, k) { return fn(k, v, this$1$1) !== false; }, reverse);
|
|
1167
1234
|
};
|
|
1168
|
-
flipSequence.__iteratorUncached = function(type, reverse) {
|
|
1235
|
+
flipSequence.__iteratorUncached = function (type, reverse) {
|
|
1169
1236
|
if (type === ITERATE_ENTRIES) {
|
|
1170
1237
|
var iterator = collection.__iterator(type, reverse);
|
|
1171
1238
|
return new Iterator(function () {
|
|
@@ -1196,15 +1263,15 @@ function mapFactory(collection, mapper, context) {
|
|
|
1196
1263
|
? notSetValue
|
|
1197
1264
|
: mapper.call(context, v, key, collection);
|
|
1198
1265
|
};
|
|
1199
|
-
mappedSequence.__iterateUncached = function(fn, reverse) {
|
|
1200
|
-
var this$1 = this;
|
|
1266
|
+
mappedSequence.__iterateUncached = function (fn, reverse) {
|
|
1267
|
+
var this$1$1 = this;
|
|
1201
1268
|
|
|
1202
1269
|
return collection.__iterate(
|
|
1203
|
-
function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1) !== false; },
|
|
1270
|
+
function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1$1) !== false; },
|
|
1204
1271
|
reverse
|
|
1205
1272
|
);
|
|
1206
1273
|
};
|
|
1207
|
-
mappedSequence.__iteratorUncached = function(type, reverse) {
|
|
1274
|
+
mappedSequence.__iteratorUncached = function (type, reverse) {
|
|
1208
1275
|
var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
|
|
1209
1276
|
return new Iterator(function () {
|
|
1210
1277
|
var step = iterator.next();
|
|
@@ -1225,14 +1292,14 @@ function mapFactory(collection, mapper, context) {
|
|
|
1225
1292
|
}
|
|
1226
1293
|
|
|
1227
1294
|
function reverseFactory(collection, useKeys) {
|
|
1228
|
-
var this$1 = this;
|
|
1295
|
+
var this$1$1 = this;
|
|
1229
1296
|
|
|
1230
1297
|
var reversedSequence = makeSequence(collection);
|
|
1231
1298
|
reversedSequence._iter = collection;
|
|
1232
1299
|
reversedSequence.size = collection.size;
|
|
1233
1300
|
reversedSequence.reverse = function () { return collection; };
|
|
1234
1301
|
if (collection.flip) {
|
|
1235
|
-
reversedSequence.flip = function() {
|
|
1302
|
+
reversedSequence.flip = function () {
|
|
1236
1303
|
var flipSequence = flipFactory(collection);
|
|
1237
1304
|
flipSequence.reverse = function () { return collection.flip(); };
|
|
1238
1305
|
return flipSequence;
|
|
@@ -1242,13 +1309,13 @@ function reverseFactory(collection, useKeys) {
|
|
|
1242
1309
|
reversedSequence.has = function (key) { return collection.has(useKeys ? key : -1 - key); };
|
|
1243
1310
|
reversedSequence.includes = function (value) { return collection.includes(value); };
|
|
1244
1311
|
reversedSequence.cacheResult = cacheResultThrough;
|
|
1245
|
-
reversedSequence.__iterate = function(fn, reverse) {
|
|
1246
|
-
var this$1 = this;
|
|
1312
|
+
reversedSequence.__iterate = function (fn, reverse) {
|
|
1313
|
+
var this$1$1 = this;
|
|
1247
1314
|
|
|
1248
1315
|
var i = 0;
|
|
1249
1316
|
reverse && ensureSize(collection);
|
|
1250
1317
|
return collection.__iterate(
|
|
1251
|
-
function (v, k) { return fn(v, useKeys ? k : reverse ? this$1.size - ++i : i++, this$1); },
|
|
1318
|
+
function (v, k) { return fn(v, useKeys ? k : reverse ? this$1$1.size - ++i : i++, this$1$1); },
|
|
1252
1319
|
!reverse
|
|
1253
1320
|
);
|
|
1254
1321
|
};
|
|
@@ -1264,7 +1331,7 @@ function reverseFactory(collection, useKeys) {
|
|
|
1264
1331
|
var entry = step.value;
|
|
1265
1332
|
return iteratorValue(
|
|
1266
1333
|
type,
|
|
1267
|
-
useKeys ? entry[0] : reverse ? this$1.size - ++i : i++,
|
|
1334
|
+
useKeys ? entry[0] : reverse ? this$1$1.size - ++i : i++,
|
|
1268
1335
|
entry[1],
|
|
1269
1336
|
step
|
|
1270
1337
|
);
|
|
@@ -1287,19 +1354,19 @@ function filterFactory(collection, predicate, context, useKeys) {
|
|
|
1287
1354
|
: notSetValue;
|
|
1288
1355
|
};
|
|
1289
1356
|
}
|
|
1290
|
-
filterSequence.__iterateUncached = function(fn, reverse) {
|
|
1291
|
-
var this$1 = this;
|
|
1357
|
+
filterSequence.__iterateUncached = function (fn, reverse) {
|
|
1358
|
+
var this$1$1 = this;
|
|
1292
1359
|
|
|
1293
1360
|
var iterations = 0;
|
|
1294
1361
|
collection.__iterate(function (v, k, c) {
|
|
1295
1362
|
if (predicate.call(context, v, k, c)) {
|
|
1296
1363
|
iterations++;
|
|
1297
|
-
return fn(v, useKeys ? k : iterations - 1, this$1);
|
|
1364
|
+
return fn(v, useKeys ? k : iterations - 1, this$1$1);
|
|
1298
1365
|
}
|
|
1299
1366
|
}, reverse);
|
|
1300
1367
|
return iterations;
|
|
1301
1368
|
};
|
|
1302
|
-
filterSequence.__iteratorUncached = function(type, reverse) {
|
|
1369
|
+
filterSequence.__iteratorUncached = function (type, reverse) {
|
|
1303
1370
|
var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
|
|
1304
1371
|
var iterations = 0;
|
|
1305
1372
|
return new Iterator(function () {
|
|
@@ -1376,7 +1443,7 @@ function sliceFactory(collection, begin, end, useKeys) {
|
|
|
1376
1443
|
sliceSize === 0 ? sliceSize : (collection.size && sliceSize) || undefined;
|
|
1377
1444
|
|
|
1378
1445
|
if (!useKeys && isSeq(collection) && sliceSize >= 0) {
|
|
1379
|
-
sliceSeq.get = function(index, notSetValue) {
|
|
1446
|
+
sliceSeq.get = function (index, notSetValue) {
|
|
1380
1447
|
index = wrapIndex(this, index);
|
|
1381
1448
|
return index >= 0 && index < sliceSize
|
|
1382
1449
|
? collection.get(index + resolvedBegin, notSetValue)
|
|
@@ -1384,8 +1451,8 @@ function sliceFactory(collection, begin, end, useKeys) {
|
|
|
1384
1451
|
};
|
|
1385
1452
|
}
|
|
1386
1453
|
|
|
1387
|
-
sliceSeq.__iterateUncached = function(fn, reverse) {
|
|
1388
|
-
var this$1 = this;
|
|
1454
|
+
sliceSeq.__iterateUncached = function (fn, reverse) {
|
|
1455
|
+
var this$1$1 = this;
|
|
1389
1456
|
|
|
1390
1457
|
if (sliceSize === 0) {
|
|
1391
1458
|
return 0;
|
|
@@ -1400,7 +1467,7 @@ function sliceFactory(collection, begin, end, useKeys) {
|
|
|
1400
1467
|
if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {
|
|
1401
1468
|
iterations++;
|
|
1402
1469
|
return (
|
|
1403
|
-
fn(v, useKeys ? k : iterations - 1, this$1) !== false &&
|
|
1470
|
+
fn(v, useKeys ? k : iterations - 1, this$1$1) !== false &&
|
|
1404
1471
|
iterations !== sliceSize
|
|
1405
1472
|
);
|
|
1406
1473
|
}
|
|
@@ -1408,7 +1475,7 @@ function sliceFactory(collection, begin, end, useKeys) {
|
|
|
1408
1475
|
return iterations;
|
|
1409
1476
|
};
|
|
1410
1477
|
|
|
1411
|
-
sliceSeq.__iteratorUncached = function(type, reverse) {
|
|
1478
|
+
sliceSeq.__iteratorUncached = function (type, reverse) {
|
|
1412
1479
|
if (sliceSize !== 0 && reverse) {
|
|
1413
1480
|
return this.cacheResult().__iterator(type, reverse);
|
|
1414
1481
|
}
|
|
@@ -1442,20 +1509,20 @@ function sliceFactory(collection, begin, end, useKeys) {
|
|
|
1442
1509
|
|
|
1443
1510
|
function takeWhileFactory(collection, predicate, context) {
|
|
1444
1511
|
var takeSequence = makeSequence(collection);
|
|
1445
|
-
takeSequence.__iterateUncached = function(fn, reverse) {
|
|
1446
|
-
var this$1 = this;
|
|
1512
|
+
takeSequence.__iterateUncached = function (fn, reverse) {
|
|
1513
|
+
var this$1$1 = this;
|
|
1447
1514
|
|
|
1448
1515
|
if (reverse) {
|
|
1449
1516
|
return this.cacheResult().__iterate(fn, reverse);
|
|
1450
1517
|
}
|
|
1451
1518
|
var iterations = 0;
|
|
1452
1519
|
collection.__iterate(
|
|
1453
|
-
function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1); }
|
|
1520
|
+
function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1$1); }
|
|
1454
1521
|
);
|
|
1455
1522
|
return iterations;
|
|
1456
1523
|
};
|
|
1457
|
-
takeSequence.__iteratorUncached = function(type, reverse) {
|
|
1458
|
-
var this$1 = this;
|
|
1524
|
+
takeSequence.__iteratorUncached = function (type, reverse) {
|
|
1525
|
+
var this$1$1 = this;
|
|
1459
1526
|
|
|
1460
1527
|
if (reverse) {
|
|
1461
1528
|
return this.cacheResult().__iterator(type, reverse);
|
|
@@ -1473,7 +1540,7 @@ function takeWhileFactory(collection, predicate, context) {
|
|
|
1473
1540
|
var entry = step.value;
|
|
1474
1541
|
var k = entry[0];
|
|
1475
1542
|
var v = entry[1];
|
|
1476
|
-
if (!predicate.call(context, v, k, this$1)) {
|
|
1543
|
+
if (!predicate.call(context, v, k, this$1$1)) {
|
|
1477
1544
|
iterating = false;
|
|
1478
1545
|
return iteratorDone();
|
|
1479
1546
|
}
|
|
@@ -1485,8 +1552,8 @@ function takeWhileFactory(collection, predicate, context) {
|
|
|
1485
1552
|
|
|
1486
1553
|
function skipWhileFactory(collection, predicate, context, useKeys) {
|
|
1487
1554
|
var skipSequence = makeSequence(collection);
|
|
1488
|
-
skipSequence.__iterateUncached = function(fn, reverse) {
|
|
1489
|
-
var this$1 = this;
|
|
1555
|
+
skipSequence.__iterateUncached = function (fn, reverse) {
|
|
1556
|
+
var this$1$1 = this;
|
|
1490
1557
|
|
|
1491
1558
|
if (reverse) {
|
|
1492
1559
|
return this.cacheResult().__iterate(fn, reverse);
|
|
@@ -1496,13 +1563,13 @@ function skipWhileFactory(collection, predicate, context, useKeys) {
|
|
|
1496
1563
|
collection.__iterate(function (v, k, c) {
|
|
1497
1564
|
if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {
|
|
1498
1565
|
iterations++;
|
|
1499
|
-
return fn(v, useKeys ? k : iterations - 1, this$1);
|
|
1566
|
+
return fn(v, useKeys ? k : iterations - 1, this$1$1);
|
|
1500
1567
|
}
|
|
1501
1568
|
});
|
|
1502
1569
|
return iterations;
|
|
1503
1570
|
};
|
|
1504
|
-
skipSequence.__iteratorUncached = function(type, reverse) {
|
|
1505
|
-
var this$1 = this;
|
|
1571
|
+
skipSequence.__iteratorUncached = function (type, reverse) {
|
|
1572
|
+
var this$1$1 = this;
|
|
1506
1573
|
|
|
1507
1574
|
if (reverse) {
|
|
1508
1575
|
return this.cacheResult().__iterator(type, reverse);
|
|
@@ -1528,7 +1595,7 @@ function skipWhileFactory(collection, predicate, context, useKeys) {
|
|
|
1528
1595
|
var entry = step.value;
|
|
1529
1596
|
k = entry[0];
|
|
1530
1597
|
v = entry[1];
|
|
1531
|
-
skipping && (skipping = predicate.call(context, v, k, this$1));
|
|
1598
|
+
skipping && (skipping = predicate.call(context, v, k, this$1$1));
|
|
1532
1599
|
} while (skipping);
|
|
1533
1600
|
return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
|
|
1534
1601
|
});
|
|
@@ -1587,7 +1654,7 @@ function concatFactory(collection, values) {
|
|
|
1587
1654
|
|
|
1588
1655
|
function flattenFactory(collection, depth, useKeys) {
|
|
1589
1656
|
var flatSequence = makeSequence(collection);
|
|
1590
|
-
flatSequence.__iterateUncached = function(fn, reverse) {
|
|
1657
|
+
flatSequence.__iterateUncached = function (fn, reverse) {
|
|
1591
1658
|
if (reverse) {
|
|
1592
1659
|
return this.cacheResult().__iterate(fn, reverse);
|
|
1593
1660
|
}
|
|
@@ -1609,7 +1676,7 @@ function flattenFactory(collection, depth, useKeys) {
|
|
|
1609
1676
|
flatDeep(collection, 0);
|
|
1610
1677
|
return iterations;
|
|
1611
1678
|
};
|
|
1612
|
-
flatSequence.__iteratorUncached = function(type, reverse) {
|
|
1679
|
+
flatSequence.__iteratorUncached = function (type, reverse) {
|
|
1613
1680
|
if (reverse) {
|
|
1614
1681
|
return this.cacheResult().__iterator(type, reverse);
|
|
1615
1682
|
}
|
|
@@ -1651,18 +1718,18 @@ function flatMapFactory(collection, mapper, context) {
|
|
|
1651
1718
|
function interposeFactory(collection, separator) {
|
|
1652
1719
|
var interposedSequence = makeSequence(collection);
|
|
1653
1720
|
interposedSequence.size = collection.size && collection.size * 2 - 1;
|
|
1654
|
-
interposedSequence.__iterateUncached = function(fn, reverse) {
|
|
1655
|
-
var this$1 = this;
|
|
1721
|
+
interposedSequence.__iterateUncached = function (fn, reverse) {
|
|
1722
|
+
var this$1$1 = this;
|
|
1656
1723
|
|
|
1657
1724
|
var iterations = 0;
|
|
1658
1725
|
collection.__iterate(
|
|
1659
|
-
function (v) { return (!iterations || fn(separator, iterations++, this$1) !== false) &&
|
|
1660
|
-
fn(v, iterations++, this$1) !== false; },
|
|
1726
|
+
function (v) { return (!iterations || fn(separator, iterations++, this$1$1) !== false) &&
|
|
1727
|
+
fn(v, iterations++, this$1$1) !== false; },
|
|
1661
1728
|
reverse
|
|
1662
1729
|
);
|
|
1663
1730
|
return iterations;
|
|
1664
1731
|
};
|
|
1665
|
-
interposedSequence.__iteratorUncached = function(type, reverse) {
|
|
1732
|
+
interposedSequence.__iteratorUncached = function (type, reverse) {
|
|
1666
1733
|
var iterator = collection.__iterator(ITERATE_VALUES, reverse);
|
|
1667
1734
|
var iterations = 0;
|
|
1668
1735
|
var step;
|
|
@@ -1692,20 +1759,22 @@ function sortFactory(collection, comparator, mapper) {
|
|
|
1692
1759
|
.map(function (v, k) { return [k, v, index++, mapper ? mapper(v, k, collection) : v]; })
|
|
1693
1760
|
.valueSeq()
|
|
1694
1761
|
.toArray();
|
|
1695
|
-
entries
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1762
|
+
entries
|
|
1763
|
+
.sort(function (a, b) { return comparator(a[3], b[3]) || a[2] - b[2]; })
|
|
1764
|
+
.forEach(
|
|
1765
|
+
isKeyedCollection
|
|
1766
|
+
? function (v, i) {
|
|
1767
|
+
entries[i].length = 2;
|
|
1768
|
+
}
|
|
1769
|
+
: function (v, i) {
|
|
1770
|
+
entries[i] = v[1];
|
|
1771
|
+
}
|
|
1772
|
+
);
|
|
1704
1773
|
return isKeyedCollection
|
|
1705
1774
|
? KeyedSeq(entries)
|
|
1706
1775
|
: isIndexed(collection)
|
|
1707
|
-
|
|
1708
|
-
|
|
1776
|
+
? IndexedSeq(entries)
|
|
1777
|
+
: SetSeq(entries);
|
|
1709
1778
|
}
|
|
1710
1779
|
|
|
1711
1780
|
function maxFactory(collection, comparator, mapper) {
|
|
@@ -1738,9 +1807,7 @@ function zipWithFactory(keyIter, zipper, iters, zipAll) {
|
|
|
1738
1807
|
zipSequence.size = zipAll ? sizes.max() : sizes.min();
|
|
1739
1808
|
// Note: this a generic base implementation of __iterate in terms of
|
|
1740
1809
|
// __iterator which may be more generically useful in the future.
|
|
1741
|
-
zipSequence.__iterate = function(fn, reverse) {
|
|
1742
|
-
var this$1 = this;
|
|
1743
|
-
|
|
1810
|
+
zipSequence.__iterate = function (fn, reverse) {
|
|
1744
1811
|
/* generic:
|
|
1745
1812
|
var iterator = this.__iterator(ITERATE_ENTRIES, reverse);
|
|
1746
1813
|
var step;
|
|
@@ -1758,13 +1825,13 @@ function zipWithFactory(keyIter, zipper, iters, zipAll) {
|
|
|
1758
1825
|
var step;
|
|
1759
1826
|
var iterations = 0;
|
|
1760
1827
|
while (!(step = iterator.next()).done) {
|
|
1761
|
-
if (fn(step.value, iterations++, this
|
|
1828
|
+
if (fn(step.value, iterations++, this) === false) {
|
|
1762
1829
|
break;
|
|
1763
1830
|
}
|
|
1764
1831
|
}
|
|
1765
1832
|
return iterations;
|
|
1766
1833
|
};
|
|
1767
|
-
zipSequence.__iteratorUncached = function(type, reverse) {
|
|
1834
|
+
zipSequence.__iteratorUncached = function (type, reverse) {
|
|
1768
1835
|
var iterators = iters.map(
|
|
1769
1836
|
function (i) { return ((i = Collection(i)), getIterator(reverse ? i.reverse() : i)); }
|
|
1770
1837
|
);
|
|
@@ -1782,7 +1849,10 @@ function zipWithFactory(keyIter, zipper, iters, zipAll) {
|
|
|
1782
1849
|
return iteratorValue(
|
|
1783
1850
|
type,
|
|
1784
1851
|
iterations++,
|
|
1785
|
-
zipper.apply(
|
|
1852
|
+
zipper.apply(
|
|
1853
|
+
null,
|
|
1854
|
+
steps.map(function (s) { return s.value; })
|
|
1855
|
+
)
|
|
1786
1856
|
);
|
|
1787
1857
|
});
|
|
1788
1858
|
};
|
|
@@ -1805,8 +1875,8 @@ function collectionClass(collection) {
|
|
|
1805
1875
|
return isKeyed(collection)
|
|
1806
1876
|
? KeyedCollection
|
|
1807
1877
|
: isIndexed(collection)
|
|
1808
|
-
|
|
1809
|
-
|
|
1878
|
+
? IndexedCollection
|
|
1879
|
+
: SetCollection;
|
|
1810
1880
|
}
|
|
1811
1881
|
|
|
1812
1882
|
function makeSequence(collection) {
|
|
@@ -1814,8 +1884,8 @@ function makeSequence(collection) {
|
|
|
1814
1884
|
(isKeyed(collection)
|
|
1815
1885
|
? KeyedSeq
|
|
1816
1886
|
: isIndexed(collection)
|
|
1817
|
-
|
|
1818
|
-
|
|
1887
|
+
? IndexedSeq
|
|
1888
|
+
: SetSeq
|
|
1819
1889
|
).prototype
|
|
1820
1890
|
);
|
|
1821
1891
|
}
|
|
@@ -1845,7 +1915,6 @@ function defaultComparator(a, b) {
|
|
|
1845
1915
|
return a > b ? 1 : a < b ? -1 : 0;
|
|
1846
1916
|
}
|
|
1847
1917
|
|
|
1848
|
-
// http://jsperf.com/copy-array-inline
|
|
1849
1918
|
function arrCopy(arr, offset) {
|
|
1850
1919
|
offset = offset || 0;
|
|
1851
1920
|
var len = Math.max(0, arr.length - offset);
|
|
@@ -1879,12 +1948,31 @@ function coerceKeyPath(keyPath) {
|
|
|
1879
1948
|
);
|
|
1880
1949
|
}
|
|
1881
1950
|
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1951
|
+
var toString = Object.prototype.toString;
|
|
1952
|
+
|
|
1953
|
+
function isPlainObject(value) {
|
|
1954
|
+
// The base prototype's toString deals with Argument objects and native namespaces like Math
|
|
1955
|
+
if (
|
|
1956
|
+
!value ||
|
|
1957
|
+
typeof value !== 'object' ||
|
|
1958
|
+
toString.call(value) !== '[object Object]'
|
|
1959
|
+
) {
|
|
1960
|
+
return false;
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
var proto = Object.getPrototypeOf(value);
|
|
1964
|
+
if (proto === null) {
|
|
1965
|
+
return true;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
// Iteratively going up the prototype chain is needed for cross-realm environments (differing contexts, iframes, etc)
|
|
1969
|
+
var parentProto = proto;
|
|
1970
|
+
var nextProto = Object.getPrototypeOf(proto);
|
|
1971
|
+
while (nextProto !== null) {
|
|
1972
|
+
parentProto = nextProto;
|
|
1973
|
+
nextProto = Object.getPrototypeOf(parentProto);
|
|
1974
|
+
}
|
|
1975
|
+
return parentProto === proto;
|
|
1888
1976
|
}
|
|
1889
1977
|
|
|
1890
1978
|
/**
|
|
@@ -1894,13 +1982,10 @@ function isPlainObj(value) {
|
|
|
1894
1982
|
function isDataStructure(value) {
|
|
1895
1983
|
return (
|
|
1896
1984
|
typeof value === 'object' &&
|
|
1897
|
-
(isImmutable(value) || Array.isArray(value) ||
|
|
1985
|
+
(isImmutable(value) || Array.isArray(value) || isPlainObject(value))
|
|
1898
1986
|
);
|
|
1899
1987
|
}
|
|
1900
1988
|
|
|
1901
|
-
/**
|
|
1902
|
-
* Converts a value to a string, adding quotes if a string was provided.
|
|
1903
|
-
*/
|
|
1904
1989
|
function quoteString(value) {
|
|
1905
1990
|
try {
|
|
1906
1991
|
return typeof value === 'string' ? JSON.stringify(value) : String(value);
|
|
@@ -1919,10 +2004,10 @@ function get(collection, key, notSetValue) {
|
|
|
1919
2004
|
return isImmutable(collection)
|
|
1920
2005
|
? collection.get(key, notSetValue)
|
|
1921
2006
|
: !has(collection, key)
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
2007
|
+
? notSetValue
|
|
2008
|
+
: typeof collection.get === 'function'
|
|
2009
|
+
? collection.get(key)
|
|
2010
|
+
: collection[key];
|
|
1926
2011
|
}
|
|
1927
2012
|
|
|
1928
2013
|
function shallowCopy(from) {
|
|
@@ -1986,7 +2071,7 @@ function set(collection, key, value) {
|
|
|
1986
2071
|
return collectionCopy;
|
|
1987
2072
|
}
|
|
1988
2073
|
|
|
1989
|
-
function updateIn(collection, keyPath, notSetValue, updater) {
|
|
2074
|
+
function updateIn$1(collection, keyPath, notSetValue, updater) {
|
|
1990
2075
|
if (!updater) {
|
|
1991
2076
|
updater = notSetValue;
|
|
1992
2077
|
notSetValue = undefined;
|
|
@@ -2037,52 +2122,52 @@ function updateInDeeply(
|
|
|
2037
2122
|
return nextUpdated === nextExisting
|
|
2038
2123
|
? existing
|
|
2039
2124
|
: nextUpdated === NOT_SET
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2125
|
+
? remove(existing, key)
|
|
2126
|
+
: set(
|
|
2127
|
+
wasNotSet ? (inImmutable ? emptyMap() : {}) : existing,
|
|
2128
|
+
key,
|
|
2129
|
+
nextUpdated
|
|
2130
|
+
);
|
|
2046
2131
|
}
|
|
2047
2132
|
|
|
2048
|
-
function setIn(collection, keyPath, value) {
|
|
2049
|
-
return updateIn(collection, keyPath, NOT_SET, function () { return value; });
|
|
2133
|
+
function setIn$1(collection, keyPath, value) {
|
|
2134
|
+
return updateIn$1(collection, keyPath, NOT_SET, function () { return value; });
|
|
2050
2135
|
}
|
|
2051
2136
|
|
|
2052
|
-
function setIn
|
|
2053
|
-
return setIn(this, keyPath, v);
|
|
2137
|
+
function setIn(keyPath, v) {
|
|
2138
|
+
return setIn$1(this, keyPath, v);
|
|
2054
2139
|
}
|
|
2055
2140
|
|
|
2056
2141
|
function removeIn(collection, keyPath) {
|
|
2057
|
-
return updateIn(collection, keyPath, function () { return NOT_SET; });
|
|
2142
|
+
return updateIn$1(collection, keyPath, function () { return NOT_SET; });
|
|
2058
2143
|
}
|
|
2059
2144
|
|
|
2060
2145
|
function deleteIn(keyPath) {
|
|
2061
2146
|
return removeIn(this, keyPath);
|
|
2062
2147
|
}
|
|
2063
2148
|
|
|
2064
|
-
function update(collection, key, notSetValue, updater) {
|
|
2065
|
-
return updateIn(collection, [key], notSetValue, updater);
|
|
2149
|
+
function update$1(collection, key, notSetValue, updater) {
|
|
2150
|
+
return updateIn$1(collection, [key], notSetValue, updater);
|
|
2066
2151
|
}
|
|
2067
2152
|
|
|
2068
|
-
function update
|
|
2153
|
+
function update(key, notSetValue, updater) {
|
|
2069
2154
|
return arguments.length === 1
|
|
2070
2155
|
? key(this)
|
|
2071
|
-
: update(this, key, notSetValue, updater);
|
|
2156
|
+
: update$1(this, key, notSetValue, updater);
|
|
2072
2157
|
}
|
|
2073
2158
|
|
|
2074
|
-
function updateIn
|
|
2075
|
-
return updateIn(this, keyPath, notSetValue, updater);
|
|
2159
|
+
function updateIn(keyPath, notSetValue, updater) {
|
|
2160
|
+
return updateIn$1(this, keyPath, notSetValue, updater);
|
|
2076
2161
|
}
|
|
2077
2162
|
|
|
2078
|
-
function merge() {
|
|
2163
|
+
function merge$1() {
|
|
2079
2164
|
var iters = [], len = arguments.length;
|
|
2080
2165
|
while ( len-- ) iters[ len ] = arguments[ len ];
|
|
2081
2166
|
|
|
2082
2167
|
return mergeIntoKeyedWith(this, iters);
|
|
2083
2168
|
}
|
|
2084
2169
|
|
|
2085
|
-
function mergeWith(merger) {
|
|
2170
|
+
function mergeWith$1(merger) {
|
|
2086
2171
|
var iters = [], len = arguments.length - 1;
|
|
2087
2172
|
while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
|
|
2088
2173
|
|
|
@@ -2113,11 +2198,7 @@ function mergeIntoKeyedWith(collection, collections, merger) {
|
|
|
2113
2198
|
return collection.withMutations(function (collection) {
|
|
2114
2199
|
var mergeIntoCollection = merger
|
|
2115
2200
|
? function (value, key) {
|
|
2116
|
-
update(
|
|
2117
|
-
collection,
|
|
2118
|
-
key,
|
|
2119
|
-
NOT_SET,
|
|
2120
|
-
function (oldVal) { return (oldVal === NOT_SET ? value : merger(oldVal, value, key)); }
|
|
2201
|
+
update$1(collection, key, NOT_SET, function (oldVal) { return oldVal === NOT_SET ? value : merger(oldVal, value, key); }
|
|
2121
2202
|
);
|
|
2122
2203
|
}
|
|
2123
2204
|
: function (value, key) {
|
|
@@ -2129,28 +2210,28 @@ function mergeIntoKeyedWith(collection, collections, merger) {
|
|
|
2129
2210
|
});
|
|
2130
2211
|
}
|
|
2131
2212
|
|
|
2132
|
-
function merge
|
|
2213
|
+
function merge(collection) {
|
|
2133
2214
|
var sources = [], len = arguments.length - 1;
|
|
2134
2215
|
while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
|
|
2135
2216
|
|
|
2136
2217
|
return mergeWithSources(collection, sources);
|
|
2137
2218
|
}
|
|
2138
2219
|
|
|
2139
|
-
function mergeWith
|
|
2220
|
+
function mergeWith(merger, collection) {
|
|
2140
2221
|
var sources = [], len = arguments.length - 2;
|
|
2141
2222
|
while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
|
|
2142
2223
|
|
|
2143
2224
|
return mergeWithSources(collection, sources, merger);
|
|
2144
2225
|
}
|
|
2145
2226
|
|
|
2146
|
-
function mergeDeep(collection) {
|
|
2227
|
+
function mergeDeep$1(collection) {
|
|
2147
2228
|
var sources = [], len = arguments.length - 1;
|
|
2148
2229
|
while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
|
|
2149
2230
|
|
|
2150
2231
|
return mergeDeepWithSources(collection, sources);
|
|
2151
2232
|
}
|
|
2152
2233
|
|
|
2153
|
-
function mergeDeepWith(merger, collection) {
|
|
2234
|
+
function mergeDeepWith$1(merger, collection) {
|
|
2154
2235
|
var sources = [], len = arguments.length - 2;
|
|
2155
2236
|
while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
|
|
2156
2237
|
|
|
@@ -2171,12 +2252,12 @@ function mergeWithSources(collection, sources, merger) {
|
|
|
2171
2252
|
return typeof merger === 'function' && collection.mergeWith
|
|
2172
2253
|
? collection.mergeWith.apply(collection, [ merger ].concat( sources ))
|
|
2173
2254
|
: collection.merge
|
|
2174
|
-
|
|
2175
|
-
|
|
2255
|
+
? collection.merge.apply(collection, sources)
|
|
2256
|
+
: collection.concat.apply(collection, sources);
|
|
2176
2257
|
}
|
|
2177
2258
|
var isArray = Array.isArray(collection);
|
|
2178
2259
|
var merged = collection;
|
|
2179
|
-
var Collection
|
|
2260
|
+
var Collection = isArray ? IndexedCollection : KeyedCollection;
|
|
2180
2261
|
var mergeItem = isArray
|
|
2181
2262
|
? function (value) {
|
|
2182
2263
|
// Copy on write
|
|
@@ -2198,30 +2279,48 @@ function mergeWithSources(collection, sources, merger) {
|
|
|
2198
2279
|
}
|
|
2199
2280
|
};
|
|
2200
2281
|
for (var i = 0; i < sources.length; i++) {
|
|
2201
|
-
Collection
|
|
2282
|
+
Collection(sources[i]).forEach(mergeItem);
|
|
2202
2283
|
}
|
|
2203
2284
|
return merged;
|
|
2204
2285
|
}
|
|
2205
2286
|
|
|
2206
2287
|
function deepMergerWith(merger) {
|
|
2207
2288
|
function deepMerger(oldValue, newValue, key) {
|
|
2208
|
-
return isDataStructure(oldValue) &&
|
|
2289
|
+
return isDataStructure(oldValue) &&
|
|
2290
|
+
isDataStructure(newValue) &&
|
|
2291
|
+
areMergeable(oldValue, newValue)
|
|
2209
2292
|
? mergeWithSources(oldValue, [newValue], deepMerger)
|
|
2210
2293
|
: merger
|
|
2211
|
-
|
|
2212
|
-
|
|
2294
|
+
? merger(oldValue, newValue, key)
|
|
2295
|
+
: newValue;
|
|
2213
2296
|
}
|
|
2214
2297
|
return deepMerger;
|
|
2215
2298
|
}
|
|
2216
2299
|
|
|
2217
|
-
|
|
2300
|
+
/**
|
|
2301
|
+
* It's unclear what the desired behavior is for merging two collections that
|
|
2302
|
+
* fall into separate categories between keyed, indexed, or set-like, so we only
|
|
2303
|
+
* consider them mergeable if they fall into the same category.
|
|
2304
|
+
*/
|
|
2305
|
+
function areMergeable(oldDataStructure, newDataStructure) {
|
|
2306
|
+
var oldSeq = Seq(oldDataStructure);
|
|
2307
|
+
var newSeq = Seq(newDataStructure);
|
|
2308
|
+
// This logic assumes that a sequence can only fall into one of the three
|
|
2309
|
+
// categories mentioned above (since there's no `isSetLike()` method).
|
|
2310
|
+
return (
|
|
2311
|
+
isIndexed(oldSeq) === isIndexed(newSeq) &&
|
|
2312
|
+
isKeyed(oldSeq) === isKeyed(newSeq)
|
|
2313
|
+
);
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
function mergeDeep() {
|
|
2218
2317
|
var iters = [], len = arguments.length;
|
|
2219
2318
|
while ( len-- ) iters[ len ] = arguments[ len ];
|
|
2220
2319
|
|
|
2221
2320
|
return mergeDeepWithSources(this, iters);
|
|
2222
2321
|
}
|
|
2223
2322
|
|
|
2224
|
-
function mergeDeepWith
|
|
2323
|
+
function mergeDeepWith(merger) {
|
|
2225
2324
|
var iters = [], len = arguments.length - 1;
|
|
2226
2325
|
while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
|
|
2227
2326
|
|
|
@@ -2232,14 +2331,14 @@ function mergeIn(keyPath) {
|
|
|
2232
2331
|
var iters = [], len = arguments.length - 1;
|
|
2233
2332
|
while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
|
|
2234
2333
|
|
|
2235
|
-
return updateIn(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
|
|
2334
|
+
return updateIn$1(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
|
|
2236
2335
|
}
|
|
2237
2336
|
|
|
2238
2337
|
function mergeDeepIn(keyPath) {
|
|
2239
2338
|
var iters = [], len = arguments.length - 1;
|
|
2240
2339
|
while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
|
|
2241
2340
|
|
|
2242
|
-
return updateIn(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
|
|
2341
|
+
return updateIn$1(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
|
|
2243
2342
|
);
|
|
2244
2343
|
}
|
|
2245
2344
|
|
|
@@ -2261,21 +2360,21 @@ function wasAltered() {
|
|
|
2261
2360
|
return this.__altered;
|
|
2262
2361
|
}
|
|
2263
2362
|
|
|
2264
|
-
var Map = (function (KeyedCollection
|
|
2363
|
+
var Map = /*@__PURE__*/(function (KeyedCollection) {
|
|
2265
2364
|
function Map(value) {
|
|
2266
2365
|
return value === null || value === undefined
|
|
2267
2366
|
? emptyMap()
|
|
2268
2367
|
: isMap(value) && !isOrdered(value)
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2368
|
+
? value
|
|
2369
|
+
: emptyMap().withMutations(function (map) {
|
|
2370
|
+
var iter = KeyedCollection(value);
|
|
2371
|
+
assertNotInfinite(iter.size);
|
|
2372
|
+
iter.forEach(function (v, k) { return map.set(k, v); });
|
|
2373
|
+
});
|
|
2275
2374
|
}
|
|
2276
2375
|
|
|
2277
|
-
if ( KeyedCollection
|
|
2278
|
-
Map.prototype = Object.create( KeyedCollection
|
|
2376
|
+
if ( KeyedCollection ) Map.__proto__ = KeyedCollection;
|
|
2377
|
+
Map.prototype = Object.create( KeyedCollection && KeyedCollection.prototype );
|
|
2279
2378
|
Map.prototype.constructor = Map;
|
|
2280
2379
|
|
|
2281
2380
|
Map.of = function of () {
|
|
@@ -2353,9 +2452,11 @@ var Map = (function (KeyedCollection$$1) {
|
|
|
2353
2452
|
};
|
|
2354
2453
|
|
|
2355
2454
|
Map.prototype.map = function map (mapper, context) {
|
|
2455
|
+
var this$1$1 = this;
|
|
2456
|
+
|
|
2356
2457
|
return this.withMutations(function (map) {
|
|
2357
2458
|
map.forEach(function (value, key) {
|
|
2358
|
-
map.set(key, mapper.call(context, value, key,
|
|
2459
|
+
map.set(key, mapper.call(context, value, key, this$1$1));
|
|
2359
2460
|
});
|
|
2360
2461
|
});
|
|
2361
2462
|
};
|
|
@@ -2367,13 +2468,13 @@ var Map = (function (KeyedCollection$$1) {
|
|
|
2367
2468
|
};
|
|
2368
2469
|
|
|
2369
2470
|
Map.prototype.__iterate = function __iterate (fn, reverse) {
|
|
2370
|
-
var this$1 = this;
|
|
2471
|
+
var this$1$1 = this;
|
|
2371
2472
|
|
|
2372
2473
|
var iterations = 0;
|
|
2373
2474
|
this._root &&
|
|
2374
2475
|
this._root.iterate(function (entry) {
|
|
2375
2476
|
iterations++;
|
|
2376
|
-
return fn(entry[1], entry[0], this$1);
|
|
2477
|
+
return fn(entry[1], entry[0], this$1$1);
|
|
2377
2478
|
}, reverse);
|
|
2378
2479
|
return iterations;
|
|
2379
2480
|
};
|
|
@@ -2402,24 +2503,24 @@ var MapPrototype = Map.prototype;
|
|
|
2402
2503
|
MapPrototype[IS_MAP_SYMBOL] = true;
|
|
2403
2504
|
MapPrototype[DELETE] = MapPrototype.remove;
|
|
2404
2505
|
MapPrototype.removeAll = MapPrototype.deleteAll;
|
|
2405
|
-
MapPrototype.setIn = setIn
|
|
2506
|
+
MapPrototype.setIn = setIn;
|
|
2406
2507
|
MapPrototype.removeIn = MapPrototype.deleteIn = deleteIn;
|
|
2407
|
-
MapPrototype.update = update
|
|
2408
|
-
MapPrototype.updateIn = updateIn
|
|
2409
|
-
MapPrototype.merge = MapPrototype.concat = merge;
|
|
2410
|
-
MapPrototype.mergeWith = mergeWith;
|
|
2411
|
-
MapPrototype.mergeDeep = mergeDeep
|
|
2412
|
-
MapPrototype.mergeDeepWith = mergeDeepWith
|
|
2508
|
+
MapPrototype.update = update;
|
|
2509
|
+
MapPrototype.updateIn = updateIn;
|
|
2510
|
+
MapPrototype.merge = MapPrototype.concat = merge$1;
|
|
2511
|
+
MapPrototype.mergeWith = mergeWith$1;
|
|
2512
|
+
MapPrototype.mergeDeep = mergeDeep;
|
|
2513
|
+
MapPrototype.mergeDeepWith = mergeDeepWith;
|
|
2413
2514
|
MapPrototype.mergeIn = mergeIn;
|
|
2414
2515
|
MapPrototype.mergeDeepIn = mergeDeepIn;
|
|
2415
2516
|
MapPrototype.withMutations = withMutations;
|
|
2416
2517
|
MapPrototype.wasAltered = wasAltered;
|
|
2417
2518
|
MapPrototype.asImmutable = asImmutable;
|
|
2418
2519
|
MapPrototype['@@transducer/init'] = MapPrototype.asMutable = asMutable;
|
|
2419
|
-
MapPrototype['@@transducer/step'] = function(result, arr) {
|
|
2520
|
+
MapPrototype['@@transducer/step'] = function (result, arr) {
|
|
2420
2521
|
return result.set(arr[0], arr[1]);
|
|
2421
2522
|
};
|
|
2422
|
-
MapPrototype['@@transducer/result'] = function(obj) {
|
|
2523
|
+
MapPrototype['@@transducer/result'] = function (obj) {
|
|
2423
2524
|
return obj.asImmutable();
|
|
2424
2525
|
};
|
|
2425
2526
|
|
|
@@ -2758,50 +2859,44 @@ ValueNode.prototype.update = function update (ownerID, shift, keyHash, key, valu
|
|
|
2758
2859
|
|
|
2759
2860
|
// #pragma Iterators
|
|
2760
2861
|
|
|
2761
|
-
ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate =
|
|
2762
|
-
fn,
|
|
2763
|
-
|
|
2764
|
-
) {
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
return false;
|
|
2862
|
+
ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate =
|
|
2863
|
+
function (fn, reverse) {
|
|
2864
|
+
var entries = this.entries;
|
|
2865
|
+
for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
|
|
2866
|
+
if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
|
|
2867
|
+
return false;
|
|
2868
|
+
}
|
|
2769
2869
|
}
|
|
2770
|
-
}
|
|
2771
|
-
};
|
|
2870
|
+
};
|
|
2772
2871
|
|
|
2773
|
-
BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate =
|
|
2774
|
-
fn,
|
|
2775
|
-
|
|
2776
|
-
) {
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
return false;
|
|
2872
|
+
BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate =
|
|
2873
|
+
function (fn, reverse) {
|
|
2874
|
+
var nodes = this.nodes;
|
|
2875
|
+
for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
|
|
2876
|
+
var node = nodes[reverse ? maxIndex - ii : ii];
|
|
2877
|
+
if (node && node.iterate(fn, reverse) === false) {
|
|
2878
|
+
return false;
|
|
2879
|
+
}
|
|
2782
2880
|
}
|
|
2783
|
-
}
|
|
2784
|
-
};
|
|
2881
|
+
};
|
|
2785
2882
|
|
|
2786
2883
|
// eslint-disable-next-line no-unused-vars
|
|
2787
|
-
ValueNode.prototype.iterate = function(fn, reverse) {
|
|
2884
|
+
ValueNode.prototype.iterate = function (fn, reverse) {
|
|
2788
2885
|
return fn(this.entry);
|
|
2789
2886
|
};
|
|
2790
2887
|
|
|
2791
|
-
var MapIterator = (function (Iterator
|
|
2888
|
+
var MapIterator = /*@__PURE__*/(function (Iterator) {
|
|
2792
2889
|
function MapIterator(map, type, reverse) {
|
|
2793
2890
|
this._type = type;
|
|
2794
2891
|
this._reverse = reverse;
|
|
2795
2892
|
this._stack = map._root && mapIteratorFrame(map._root);
|
|
2796
2893
|
}
|
|
2797
2894
|
|
|
2798
|
-
if ( Iterator
|
|
2799
|
-
MapIterator.prototype = Object.create( Iterator
|
|
2895
|
+
if ( Iterator ) MapIterator.__proto__ = Iterator;
|
|
2896
|
+
MapIterator.prototype = Object.create( Iterator && Iterator.prototype );
|
|
2800
2897
|
MapIterator.prototype.constructor = MapIterator;
|
|
2801
2898
|
|
|
2802
2899
|
MapIterator.prototype.next = function next () {
|
|
2803
|
-
var this$1 = this;
|
|
2804
|
-
|
|
2805
2900
|
var type = this._type;
|
|
2806
2901
|
var stack = this._stack;
|
|
2807
2902
|
while (stack) {
|
|
@@ -2817,23 +2912,23 @@ var MapIterator = (function (Iterator$$1) {
|
|
|
2817
2912
|
if (index <= maxIndex) {
|
|
2818
2913
|
return mapIteratorValue(
|
|
2819
2914
|
type,
|
|
2820
|
-
node.entries[this
|
|
2915
|
+
node.entries[this._reverse ? maxIndex - index : index]
|
|
2821
2916
|
);
|
|
2822
2917
|
}
|
|
2823
2918
|
} else {
|
|
2824
2919
|
maxIndex = node.nodes.length - 1;
|
|
2825
2920
|
if (index <= maxIndex) {
|
|
2826
|
-
var subNode = node.nodes[this
|
|
2921
|
+
var subNode = node.nodes[this._reverse ? maxIndex - index : index];
|
|
2827
2922
|
if (subNode) {
|
|
2828
2923
|
if (subNode.entry) {
|
|
2829
2924
|
return mapIteratorValue(type, subNode.entry);
|
|
2830
2925
|
}
|
|
2831
|
-
stack = this
|
|
2926
|
+
stack = this._stack = mapIteratorFrame(subNode, stack);
|
|
2832
2927
|
}
|
|
2833
2928
|
continue;
|
|
2834
2929
|
}
|
|
2835
2930
|
}
|
|
2836
|
-
stack = this
|
|
2931
|
+
stack = this._stack = this._stack.__prev;
|
|
2837
2932
|
}
|
|
2838
2933
|
return iteratorDone();
|
|
2839
2934
|
};
|
|
@@ -2853,12 +2948,12 @@ function mapIteratorFrame(node, prev) {
|
|
|
2853
2948
|
};
|
|
2854
2949
|
}
|
|
2855
2950
|
|
|
2856
|
-
function makeMap(size, root, ownerID, hash
|
|
2951
|
+
function makeMap(size, root, ownerID, hash) {
|
|
2857
2952
|
var map = Object.create(MapPrototype);
|
|
2858
2953
|
map.size = size;
|
|
2859
2954
|
map._root = root;
|
|
2860
2955
|
map.__ownerID = ownerID;
|
|
2861
|
-
map.__hash = hash
|
|
2956
|
+
map.__hash = hash;
|
|
2862
2957
|
map.__altered = false;
|
|
2863
2958
|
return map;
|
|
2864
2959
|
}
|
|
@@ -3055,7 +3150,7 @@ function isList(maybeList) {
|
|
|
3055
3150
|
return Boolean(maybeList && maybeList[IS_LIST_SYMBOL]);
|
|
3056
3151
|
}
|
|
3057
3152
|
|
|
3058
|
-
var List = (function (IndexedCollection
|
|
3153
|
+
var List = /*@__PURE__*/(function (IndexedCollection) {
|
|
3059
3154
|
function List(value) {
|
|
3060
3155
|
var empty = emptyList();
|
|
3061
3156
|
if (value === null || value === undefined) {
|
|
@@ -3064,7 +3159,7 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3064
3159
|
if (isList(value)) {
|
|
3065
3160
|
return value;
|
|
3066
3161
|
}
|
|
3067
|
-
var iter = IndexedCollection
|
|
3162
|
+
var iter = IndexedCollection(value);
|
|
3068
3163
|
var size = iter.size;
|
|
3069
3164
|
if (size === 0) {
|
|
3070
3165
|
return empty;
|
|
@@ -3079,8 +3174,8 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3079
3174
|
});
|
|
3080
3175
|
}
|
|
3081
3176
|
|
|
3082
|
-
if ( IndexedCollection
|
|
3083
|
-
List.prototype = Object.create( IndexedCollection
|
|
3177
|
+
if ( IndexedCollection ) List.__proto__ = IndexedCollection;
|
|
3178
|
+
List.prototype = Object.create( IndexedCollection && IndexedCollection.prototype );
|
|
3084
3179
|
List.prototype.constructor = List;
|
|
3085
3180
|
|
|
3086
3181
|
List.of = function of (/*...values*/) {
|
|
@@ -3113,10 +3208,10 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3113
3208
|
return !this.has(index)
|
|
3114
3209
|
? this
|
|
3115
3210
|
: index === 0
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3211
|
+
? this.shift()
|
|
3212
|
+
: index === this.size - 1
|
|
3213
|
+
? this.pop()
|
|
3214
|
+
: this.splice(index, 1);
|
|
3120
3215
|
};
|
|
3121
3216
|
|
|
3122
3217
|
List.prototype.insert = function insert (index, value) {
|
|
@@ -3130,8 +3225,7 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3130
3225
|
if (this.__ownerID) {
|
|
3131
3226
|
this.size = this._origin = this._capacity = 0;
|
|
3132
3227
|
this._level = SHIFT;
|
|
3133
|
-
this._root = this._tail =
|
|
3134
|
-
this.__hash = undefined;
|
|
3228
|
+
this._root = this._tail = this.__hash = undefined;
|
|
3135
3229
|
this.__altered = true;
|
|
3136
3230
|
return this;
|
|
3137
3231
|
}
|
|
@@ -3175,7 +3269,7 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3175
3269
|
var seqs = [];
|
|
3176
3270
|
for (var i = 0; i < arguments.length; i++) {
|
|
3177
3271
|
var argument = arguments$1[i];
|
|
3178
|
-
var seq = IndexedCollection
|
|
3272
|
+
var seq = IndexedCollection(
|
|
3179
3273
|
typeof argument !== 'string' && hasIterator(argument)
|
|
3180
3274
|
? argument
|
|
3181
3275
|
: [argument]
|
|
@@ -3200,11 +3294,11 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3200
3294
|
};
|
|
3201
3295
|
|
|
3202
3296
|
List.prototype.map = function map (mapper, context) {
|
|
3203
|
-
var this$1 = this;
|
|
3297
|
+
var this$1$1 = this;
|
|
3204
3298
|
|
|
3205
3299
|
return this.withMutations(function (list) {
|
|
3206
|
-
for (var i = 0; i < this$1.size; i++) {
|
|
3207
|
-
list.set(i, mapper.call(context, list.get(i), i,
|
|
3300
|
+
for (var i = 0; i < this$1$1.size; i++) {
|
|
3301
|
+
list.set(i, mapper.call(context, list.get(i), i, this$1$1));
|
|
3208
3302
|
}
|
|
3209
3303
|
});
|
|
3210
3304
|
};
|
|
@@ -3235,13 +3329,11 @@ var List = (function (IndexedCollection$$1) {
|
|
|
3235
3329
|
};
|
|
3236
3330
|
|
|
3237
3331
|
List.prototype.__iterate = function __iterate (fn, reverse) {
|
|
3238
|
-
var this$1 = this;
|
|
3239
|
-
|
|
3240
3332
|
var index = reverse ? this.size : 0;
|
|
3241
3333
|
var values = iterateList(this, reverse);
|
|
3242
3334
|
var value;
|
|
3243
3335
|
while ((value = values()) !== DONE) {
|
|
3244
|
-
if (fn(value, reverse ? --index : index++, this
|
|
3336
|
+
if (fn(value, reverse ? --index : index++, this) === false) {
|
|
3245
3337
|
break;
|
|
3246
3338
|
}
|
|
3247
3339
|
}
|
|
@@ -3280,20 +3372,20 @@ var ListPrototype = List.prototype;
|
|
|
3280
3372
|
ListPrototype[IS_LIST_SYMBOL] = true;
|
|
3281
3373
|
ListPrototype[DELETE] = ListPrototype.remove;
|
|
3282
3374
|
ListPrototype.merge = ListPrototype.concat;
|
|
3283
|
-
ListPrototype.setIn = setIn
|
|
3375
|
+
ListPrototype.setIn = setIn;
|
|
3284
3376
|
ListPrototype.deleteIn = ListPrototype.removeIn = deleteIn;
|
|
3285
|
-
ListPrototype.update = update
|
|
3286
|
-
ListPrototype.updateIn = updateIn
|
|
3377
|
+
ListPrototype.update = update;
|
|
3378
|
+
ListPrototype.updateIn = updateIn;
|
|
3287
3379
|
ListPrototype.mergeIn = mergeIn;
|
|
3288
3380
|
ListPrototype.mergeDeepIn = mergeDeepIn;
|
|
3289
3381
|
ListPrototype.withMutations = withMutations;
|
|
3290
3382
|
ListPrototype.wasAltered = wasAltered;
|
|
3291
3383
|
ListPrototype.asImmutable = asImmutable;
|
|
3292
3384
|
ListPrototype['@@transducer/init'] = ListPrototype.asMutable = asMutable;
|
|
3293
|
-
ListPrototype['@@transducer/step'] = function(result, arr) {
|
|
3385
|
+
ListPrototype['@@transducer/step'] = function (result, arr) {
|
|
3294
3386
|
return result.push(arr);
|
|
3295
3387
|
};
|
|
3296
|
-
ListPrototype['@@transducer/result'] = function(obj) {
|
|
3388
|
+
ListPrototype['@@transducer/result'] = function (obj) {
|
|
3297
3389
|
return obj.asImmutable();
|
|
3298
3390
|
};
|
|
3299
3391
|
|
|
@@ -3576,8 +3668,8 @@ function setListBounds(list, begin, end) {
|
|
|
3576
3668
|
end === undefined
|
|
3577
3669
|
? oldCapacity
|
|
3578
3670
|
: end < 0
|
|
3579
|
-
|
|
3580
|
-
|
|
3671
|
+
? oldCapacity + end
|
|
3672
|
+
: oldOrigin + end;
|
|
3581
3673
|
if (newOrigin === oldOrigin && newCapacity === oldCapacity) {
|
|
3582
3674
|
return list;
|
|
3583
3675
|
}
|
|
@@ -3625,8 +3717,8 @@ function setListBounds(list, begin, end) {
|
|
|
3625
3717
|
newTailOffset < oldTailOffset
|
|
3626
3718
|
? listNodeFor(list, newCapacity - 1)
|
|
3627
3719
|
: newTailOffset > oldTailOffset
|
|
3628
|
-
|
|
3629
|
-
|
|
3720
|
+
? new VNode([], owner)
|
|
3721
|
+
: oldTail;
|
|
3630
3722
|
|
|
3631
3723
|
// Merge Tail into tree.
|
|
3632
3724
|
if (
|
|
@@ -3709,21 +3801,21 @@ function getTailOffset(size) {
|
|
|
3709
3801
|
return size < SIZE ? 0 : ((size - 1) >>> SHIFT) << SHIFT;
|
|
3710
3802
|
}
|
|
3711
3803
|
|
|
3712
|
-
var OrderedMap = (function (Map
|
|
3804
|
+
var OrderedMap = /*@__PURE__*/(function (Map) {
|
|
3713
3805
|
function OrderedMap(value) {
|
|
3714
3806
|
return value === null || value === undefined
|
|
3715
3807
|
? emptyOrderedMap()
|
|
3716
3808
|
: isOrderedMap(value)
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3809
|
+
? value
|
|
3810
|
+
: emptyOrderedMap().withMutations(function (map) {
|
|
3811
|
+
var iter = KeyedCollection(value);
|
|
3812
|
+
assertNotInfinite(iter.size);
|
|
3813
|
+
iter.forEach(function (v, k) { return map.set(k, v); });
|
|
3814
|
+
});
|
|
3723
3815
|
}
|
|
3724
3816
|
|
|
3725
|
-
if ( Map
|
|
3726
|
-
OrderedMap.prototype = Object.create( Map
|
|
3817
|
+
if ( Map ) OrderedMap.__proto__ = Map;
|
|
3818
|
+
OrderedMap.prototype = Object.create( Map && Map.prototype );
|
|
3727
3819
|
OrderedMap.prototype.constructor = OrderedMap;
|
|
3728
3820
|
|
|
3729
3821
|
OrderedMap.of = function of (/*...values*/) {
|
|
@@ -3751,6 +3843,7 @@ var OrderedMap = (function (Map$$1) {
|
|
|
3751
3843
|
this.size = 0;
|
|
3752
3844
|
this._map.clear();
|
|
3753
3845
|
this._list.clear();
|
|
3846
|
+
this.__altered = true;
|
|
3754
3847
|
return this;
|
|
3755
3848
|
}
|
|
3756
3849
|
return emptyOrderedMap();
|
|
@@ -3764,15 +3857,11 @@ var OrderedMap = (function (Map$$1) {
|
|
|
3764
3857
|
return updateOrderedMap(this, k, NOT_SET);
|
|
3765
3858
|
};
|
|
3766
3859
|
|
|
3767
|
-
OrderedMap.prototype.wasAltered = function wasAltered () {
|
|
3768
|
-
return this._map.wasAltered() || this._list.wasAltered();
|
|
3769
|
-
};
|
|
3770
|
-
|
|
3771
3860
|
OrderedMap.prototype.__iterate = function __iterate (fn, reverse) {
|
|
3772
|
-
var this$1 = this;
|
|
3861
|
+
var this$1$1 = this;
|
|
3773
3862
|
|
|
3774
3863
|
return this._list.__iterate(
|
|
3775
|
-
function (entry) { return entry && fn(entry[1], entry[0], this$1); },
|
|
3864
|
+
function (entry) { return entry && fn(entry[1], entry[0], this$1$1); },
|
|
3776
3865
|
reverse
|
|
3777
3866
|
);
|
|
3778
3867
|
};
|
|
@@ -3792,6 +3881,7 @@ var OrderedMap = (function (Map$$1) {
|
|
|
3792
3881
|
return emptyOrderedMap();
|
|
3793
3882
|
}
|
|
3794
3883
|
this.__ownerID = ownerID;
|
|
3884
|
+
this.__altered = false;
|
|
3795
3885
|
this._map = newMap;
|
|
3796
3886
|
this._list = newList;
|
|
3797
3887
|
return this;
|
|
@@ -3814,6 +3904,7 @@ function makeOrderedMap(map, list, ownerID, hash) {
|
|
|
3814
3904
|
omap._list = list;
|
|
3815
3905
|
omap.__ownerID = ownerID;
|
|
3816
3906
|
omap.__hash = hash;
|
|
3907
|
+
omap.__altered = false;
|
|
3817
3908
|
return omap;
|
|
3818
3909
|
}
|
|
3819
3910
|
|
|
@@ -3866,6 +3957,7 @@ function updateOrderedMap(omap, k, v) {
|
|
|
3866
3957
|
omap._map = newMap;
|
|
3867
3958
|
omap._list = newList;
|
|
3868
3959
|
omap.__hash = undefined;
|
|
3960
|
+
omap.__altered = true;
|
|
3869
3961
|
return omap;
|
|
3870
3962
|
}
|
|
3871
3963
|
return makeOrderedMap(newMap, newList);
|
|
@@ -3877,17 +3969,17 @@ function isStack(maybeStack) {
|
|
|
3877
3969
|
return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);
|
|
3878
3970
|
}
|
|
3879
3971
|
|
|
3880
|
-
var Stack = (function (IndexedCollection
|
|
3972
|
+
var Stack = /*@__PURE__*/(function (IndexedCollection) {
|
|
3881
3973
|
function Stack(value) {
|
|
3882
3974
|
return value === null || value === undefined
|
|
3883
3975
|
? emptyStack()
|
|
3884
3976
|
: isStack(value)
|
|
3885
|
-
|
|
3886
|
-
|
|
3977
|
+
? value
|
|
3978
|
+
: emptyStack().pushAll(value);
|
|
3887
3979
|
}
|
|
3888
3980
|
|
|
3889
|
-
if ( IndexedCollection
|
|
3890
|
-
Stack.prototype = Object.create( IndexedCollection
|
|
3981
|
+
if ( IndexedCollection ) Stack.__proto__ = IndexedCollection;
|
|
3982
|
+
Stack.prototype = Object.create( IndexedCollection && IndexedCollection.prototype );
|
|
3891
3983
|
Stack.prototype.constructor = Stack;
|
|
3892
3984
|
|
|
3893
3985
|
Stack.of = function of (/*...values*/) {
|
|
@@ -3940,7 +4032,7 @@ var Stack = (function (IndexedCollection$$1) {
|
|
|
3940
4032
|
};
|
|
3941
4033
|
|
|
3942
4034
|
Stack.prototype.pushAll = function pushAll (iter) {
|
|
3943
|
-
iter = IndexedCollection
|
|
4035
|
+
iter = IndexedCollection(iter);
|
|
3944
4036
|
if (iter.size === 0) {
|
|
3945
4037
|
return this;
|
|
3946
4038
|
}
|
|
@@ -3993,7 +4085,7 @@ var Stack = (function (IndexedCollection$$1) {
|
|
|
3993
4085
|
var resolvedEnd = resolveEnd(end, this.size);
|
|
3994
4086
|
if (resolvedEnd !== this.size) {
|
|
3995
4087
|
// super.slice(begin, end);
|
|
3996
|
-
return IndexedCollection
|
|
4088
|
+
return IndexedCollection.prototype.slice.call(this, begin, end);
|
|
3997
4089
|
}
|
|
3998
4090
|
var newSize = this.size - resolvedBegin;
|
|
3999
4091
|
var head = this._head;
|
|
@@ -4030,18 +4122,18 @@ var Stack = (function (IndexedCollection$$1) {
|
|
|
4030
4122
|
// @pragma Iteration
|
|
4031
4123
|
|
|
4032
4124
|
Stack.prototype.__iterate = function __iterate (fn, reverse) {
|
|
4033
|
-
var this$1 = this;
|
|
4125
|
+
var this$1$1 = this;
|
|
4034
4126
|
|
|
4035
4127
|
if (reverse) {
|
|
4036
4128
|
return new ArraySeq(this.toArray()).__iterate(
|
|
4037
|
-
function (v, k) { return fn(v, k, this$1); },
|
|
4129
|
+
function (v, k) { return fn(v, k, this$1$1); },
|
|
4038
4130
|
reverse
|
|
4039
4131
|
);
|
|
4040
4132
|
}
|
|
4041
4133
|
var iterations = 0;
|
|
4042
4134
|
var node = this._head;
|
|
4043
4135
|
while (node) {
|
|
4044
|
-
if (fn(node.value, iterations++, this
|
|
4136
|
+
if (fn(node.value, iterations++, this) === false) {
|
|
4045
4137
|
break;
|
|
4046
4138
|
}
|
|
4047
4139
|
node = node.next;
|
|
@@ -4079,10 +4171,10 @@ StackPrototype.withMutations = withMutations;
|
|
|
4079
4171
|
StackPrototype.wasAltered = wasAltered;
|
|
4080
4172
|
StackPrototype.asImmutable = asImmutable;
|
|
4081
4173
|
StackPrototype['@@transducer/init'] = StackPrototype.asMutable = asMutable;
|
|
4082
|
-
StackPrototype['@@transducer/step'] = function(result, arr) {
|
|
4174
|
+
StackPrototype['@@transducer/step'] = function (result, arr) {
|
|
4083
4175
|
return result.unshift(arr);
|
|
4084
4176
|
};
|
|
4085
|
-
StackPrototype['@@transducer/result'] = function(obj) {
|
|
4177
|
+
StackPrototype['@@transducer/result'] = function (obj) {
|
|
4086
4178
|
return obj.asImmutable();
|
|
4087
4179
|
};
|
|
4088
4180
|
|
|
@@ -4166,8 +4258,8 @@ function deepEqual(a, b) {
|
|
|
4166
4258
|
notAssociative
|
|
4167
4259
|
? !a.has(v)
|
|
4168
4260
|
: flipped
|
|
4169
|
-
|
|
4170
|
-
|
|
4261
|
+
? !is(v, a.get(k, NOT_SET))
|
|
4262
|
+
: !is(a.get(k, NOT_SET), v)
|
|
4171
4263
|
) {
|
|
4172
4264
|
allEqual = false;
|
|
4173
4265
|
return false;
|
|
@@ -4177,9 +4269,6 @@ function deepEqual(a, b) {
|
|
|
4177
4269
|
return allEqual && a.size === bSize;
|
|
4178
4270
|
}
|
|
4179
4271
|
|
|
4180
|
-
/**
|
|
4181
|
-
* Contributes additional methods to a constructor
|
|
4182
|
-
*/
|
|
4183
4272
|
function mixin(ctor, methods) {
|
|
4184
4273
|
var keyCopier = function (key) {
|
|
4185
4274
|
ctor.prototype[key] = methods[key];
|
|
@@ -4214,21 +4303,21 @@ function toJS(value) {
|
|
|
4214
4303
|
return result;
|
|
4215
4304
|
}
|
|
4216
4305
|
|
|
4217
|
-
var Set = (function (SetCollection
|
|
4306
|
+
var Set = /*@__PURE__*/(function (SetCollection) {
|
|
4218
4307
|
function Set(value) {
|
|
4219
4308
|
return value === null || value === undefined
|
|
4220
4309
|
? emptySet()
|
|
4221
4310
|
: isSet(value) && !isOrdered(value)
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4311
|
+
? value
|
|
4312
|
+
: emptySet().withMutations(function (set) {
|
|
4313
|
+
var iter = SetCollection(value);
|
|
4314
|
+
assertNotInfinite(iter.size);
|
|
4315
|
+
iter.forEach(function (v) { return set.add(v); });
|
|
4316
|
+
});
|
|
4228
4317
|
}
|
|
4229
4318
|
|
|
4230
|
-
if ( SetCollection
|
|
4231
|
-
Set.prototype = Object.create( SetCollection
|
|
4319
|
+
if ( SetCollection ) Set.__proto__ = SetCollection;
|
|
4320
|
+
Set.prototype = Object.create( SetCollection && SetCollection.prototype );
|
|
4232
4321
|
Set.prototype.constructor = Set;
|
|
4233
4322
|
|
|
4234
4323
|
Set.of = function of (/*...values*/) {
|
|
@@ -4280,9 +4369,27 @@ var Set = (function (SetCollection$$1) {
|
|
|
4280
4369
|
// @pragma Composition
|
|
4281
4370
|
|
|
4282
4371
|
Set.prototype.map = function map (mapper, context) {
|
|
4283
|
-
var this$1 = this;
|
|
4372
|
+
var this$1$1 = this;
|
|
4373
|
+
|
|
4374
|
+
// keep track if the set is altered by the map function
|
|
4375
|
+
var didChanges = false;
|
|
4376
|
+
|
|
4377
|
+
var newMap = updateSet(
|
|
4378
|
+
this,
|
|
4379
|
+
this._map.mapEntries(function (ref) {
|
|
4380
|
+
var v = ref[1];
|
|
4381
|
+
|
|
4382
|
+
var mapped = mapper.call(context, v, v, this$1$1);
|
|
4284
4383
|
|
|
4285
|
-
|
|
4384
|
+
if (mapped !== v) {
|
|
4385
|
+
didChanges = true;
|
|
4386
|
+
}
|
|
4387
|
+
|
|
4388
|
+
return [mapped, mapped];
|
|
4389
|
+
}, context)
|
|
4390
|
+
);
|
|
4391
|
+
|
|
4392
|
+
return didChanges ? newMap : this;
|
|
4286
4393
|
};
|
|
4287
4394
|
|
|
4288
4395
|
Set.prototype.union = function union () {
|
|
@@ -4298,7 +4405,7 @@ var Set = (function (SetCollection$$1) {
|
|
|
4298
4405
|
}
|
|
4299
4406
|
return this.withMutations(function (set) {
|
|
4300
4407
|
for (var ii = 0; ii < iters.length; ii++) {
|
|
4301
|
-
SetCollection
|
|
4408
|
+
SetCollection(iters[ii]).forEach(function (value) { return set.add(value); });
|
|
4302
4409
|
}
|
|
4303
4410
|
});
|
|
4304
4411
|
};
|
|
@@ -4310,7 +4417,7 @@ var Set = (function (SetCollection$$1) {
|
|
|
4310
4417
|
if (iters.length === 0) {
|
|
4311
4418
|
return this;
|
|
4312
4419
|
}
|
|
4313
|
-
iters = iters.map(function (iter) { return SetCollection
|
|
4420
|
+
iters = iters.map(function (iter) { return SetCollection(iter); });
|
|
4314
4421
|
var toRemove = [];
|
|
4315
4422
|
this.forEach(function (value) {
|
|
4316
4423
|
if (!iters.every(function (iter) { return iter.includes(value); })) {
|
|
@@ -4331,7 +4438,7 @@ var Set = (function (SetCollection$$1) {
|
|
|
4331
4438
|
if (iters.length === 0) {
|
|
4332
4439
|
return this;
|
|
4333
4440
|
}
|
|
4334
|
-
iters = iters.map(function (iter) { return SetCollection
|
|
4441
|
+
iters = iters.map(function (iter) { return SetCollection(iter); });
|
|
4335
4442
|
var toRemove = [];
|
|
4336
4443
|
this.forEach(function (value) {
|
|
4337
4444
|
if (iters.some(function (iter) { return iter.includes(value); })) {
|
|
@@ -4360,9 +4467,9 @@ var Set = (function (SetCollection$$1) {
|
|
|
4360
4467
|
};
|
|
4361
4468
|
|
|
4362
4469
|
Set.prototype.__iterate = function __iterate (fn, reverse) {
|
|
4363
|
-
var this$1 = this;
|
|
4470
|
+
var this$1$1 = this;
|
|
4364
4471
|
|
|
4365
|
-
return this._map.__iterate(function (k) { return fn(k, k, this$1); }, reverse);
|
|
4472
|
+
return this._map.__iterate(function (k) { return fn(k, k, this$1$1); }, reverse);
|
|
4366
4473
|
};
|
|
4367
4474
|
|
|
4368
4475
|
Set.prototype.__iterator = function __iterator (type, reverse) {
|
|
@@ -4397,10 +4504,10 @@ SetPrototype.merge = SetPrototype.concat = SetPrototype.union;
|
|
|
4397
4504
|
SetPrototype.withMutations = withMutations;
|
|
4398
4505
|
SetPrototype.asImmutable = asImmutable;
|
|
4399
4506
|
SetPrototype['@@transducer/init'] = SetPrototype.asMutable = asMutable;
|
|
4400
|
-
SetPrototype['@@transducer/step'] = function(result, arr) {
|
|
4507
|
+
SetPrototype['@@transducer/step'] = function (result, arr) {
|
|
4401
4508
|
return result.add(arr);
|
|
4402
4509
|
};
|
|
4403
|
-
SetPrototype['@@transducer/result'] = function(obj) {
|
|
4510
|
+
SetPrototype['@@transducer/result'] = function (obj) {
|
|
4404
4511
|
return obj.asImmutable();
|
|
4405
4512
|
};
|
|
4406
4513
|
|
|
@@ -4416,8 +4523,8 @@ function updateSet(set, newMap) {
|
|
|
4416
4523
|
return newMap === set._map
|
|
4417
4524
|
? set
|
|
4418
4525
|
: newMap.size === 0
|
|
4419
|
-
|
|
4420
|
-
|
|
4526
|
+
? set.__empty()
|
|
4527
|
+
: set.__make(newMap);
|
|
4421
4528
|
}
|
|
4422
4529
|
|
|
4423
4530
|
function makeSet(map, ownerID) {
|
|
@@ -4438,7 +4545,7 @@ function emptySet() {
|
|
|
4438
4545
|
* (exclusive), by step, where start defaults to 0, step to 1, and end to
|
|
4439
4546
|
* infinity. When start is equal to end, returns empty list.
|
|
4440
4547
|
*/
|
|
4441
|
-
var Range = (function (IndexedSeq
|
|
4548
|
+
var Range = /*@__PURE__*/(function (IndexedSeq) {
|
|
4442
4549
|
function Range(start, end, step) {
|
|
4443
4550
|
if (!(this instanceof Range)) {
|
|
4444
4551
|
return new Range(start, end, step);
|
|
@@ -4464,8 +4571,8 @@ var Range = (function (IndexedSeq$$1) {
|
|
|
4464
4571
|
}
|
|
4465
4572
|
}
|
|
4466
4573
|
|
|
4467
|
-
if ( IndexedSeq
|
|
4468
|
-
Range.prototype = Object.create( IndexedSeq
|
|
4574
|
+
if ( IndexedSeq ) Range.__proto__ = IndexedSeq;
|
|
4575
|
+
Range.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
|
|
4469
4576
|
Range.prototype.constructor = Range;
|
|
4470
4577
|
|
|
4471
4578
|
Range.prototype.toString = function toString () {
|
|
@@ -4529,14 +4636,12 @@ var Range = (function (IndexedSeq$$1) {
|
|
|
4529
4636
|
};
|
|
4530
4637
|
|
|
4531
4638
|
Range.prototype.__iterate = function __iterate (fn, reverse) {
|
|
4532
|
-
var this$1 = this;
|
|
4533
|
-
|
|
4534
4639
|
var size = this.size;
|
|
4535
4640
|
var step = this._step;
|
|
4536
4641
|
var value = reverse ? this._start + (size - 1) * step : this._start;
|
|
4537
4642
|
var i = 0;
|
|
4538
4643
|
while (i !== size) {
|
|
4539
|
-
if (fn(value, reverse ? size - ++i : i++, this
|
|
4644
|
+
if (fn(value, reverse ? size - ++i : i++, this) === false) {
|
|
4540
4645
|
break;
|
|
4541
4646
|
}
|
|
4542
4647
|
value += reverse ? -step : step;
|
|
@@ -4572,7 +4677,7 @@ var Range = (function (IndexedSeq$$1) {
|
|
|
4572
4677
|
|
|
4573
4678
|
var EMPTY_RANGE;
|
|
4574
4679
|
|
|
4575
|
-
function getIn(collection, searchKeyPath, notSetValue) {
|
|
4680
|
+
function getIn$1(collection, searchKeyPath, notSetValue) {
|
|
4576
4681
|
var keyPath = coerceKeyPath(searchKeyPath);
|
|
4577
4682
|
var i = 0;
|
|
4578
4683
|
while (i !== keyPath.length) {
|
|
@@ -4584,16 +4689,16 @@ function getIn(collection, searchKeyPath, notSetValue) {
|
|
|
4584
4689
|
return collection;
|
|
4585
4690
|
}
|
|
4586
4691
|
|
|
4587
|
-
function getIn
|
|
4588
|
-
return getIn(this, searchKeyPath, notSetValue);
|
|
4692
|
+
function getIn(searchKeyPath, notSetValue) {
|
|
4693
|
+
return getIn$1(this, searchKeyPath, notSetValue);
|
|
4589
4694
|
}
|
|
4590
4695
|
|
|
4591
|
-
function hasIn(collection, keyPath) {
|
|
4592
|
-
return getIn(collection, keyPath, NOT_SET) !== NOT_SET;
|
|
4696
|
+
function hasIn$1(collection, keyPath) {
|
|
4697
|
+
return getIn$1(collection, keyPath, NOT_SET) !== NOT_SET;
|
|
4593
4698
|
}
|
|
4594
4699
|
|
|
4595
|
-
function hasIn
|
|
4596
|
-
return hasIn(this, searchKeyPath);
|
|
4700
|
+
function hasIn(searchKeyPath) {
|
|
4701
|
+
return hasIn$1(this, searchKeyPath);
|
|
4597
4702
|
}
|
|
4598
4703
|
|
|
4599
4704
|
function toObject() {
|
|
@@ -4671,8 +4776,8 @@ mixin(Collection, {
|
|
|
4671
4776
|
return isIndexed(this)
|
|
4672
4777
|
? this.toIndexedSeq()
|
|
4673
4778
|
: isKeyed(this)
|
|
4674
|
-
|
|
4675
|
-
|
|
4779
|
+
? this.toKeyedSeq()
|
|
4780
|
+
: this.toSetSeq();
|
|
4676
4781
|
},
|
|
4677
4782
|
|
|
4678
4783
|
toStack: function toStack() {
|
|
@@ -4698,9 +4803,7 @@ mixin(Collection, {
|
|
|
4698
4803
|
return (
|
|
4699
4804
|
head +
|
|
4700
4805
|
' ' +
|
|
4701
|
-
this.toSeq()
|
|
4702
|
-
.map(this.__toStringMapper)
|
|
4703
|
-
.join(', ') +
|
|
4806
|
+
this.toSeq().map(this.__toStringMapper).join(', ') +
|
|
4704
4807
|
' ' +
|
|
4705
4808
|
tail
|
|
4706
4809
|
);
|
|
@@ -4841,10 +4944,7 @@ mixin(Collection, {
|
|
|
4841
4944
|
// We cache as an entries array, so we can just return the cache!
|
|
4842
4945
|
return new ArraySeq(collection._cache);
|
|
4843
4946
|
}
|
|
4844
|
-
var entriesSequence = collection
|
|
4845
|
-
.toSeq()
|
|
4846
|
-
.map(entryMapper)
|
|
4847
|
-
.toIndexedSeq();
|
|
4947
|
+
var entriesSequence = collection.toSeq().map(entryMapper).toIndexedSeq();
|
|
4848
4948
|
entriesSequence.fromEntrySeq = function () { return collection.toSeq(); };
|
|
4849
4949
|
return entriesSequence;
|
|
4850
4950
|
},
|
|
@@ -4870,9 +4970,7 @@ mixin(Collection, {
|
|
|
4870
4970
|
},
|
|
4871
4971
|
|
|
4872
4972
|
findLast: function findLast(predicate, context, notSetValue) {
|
|
4873
|
-
return this.toKeyedSeq()
|
|
4874
|
-
.reverse()
|
|
4875
|
-
.find(predicate, context, notSetValue);
|
|
4973
|
+
return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);
|
|
4876
4974
|
},
|
|
4877
4975
|
|
|
4878
4976
|
findLastEntry: function findLastEntry(predicate, context, notSetValue) {
|
|
@@ -4882,9 +4980,7 @@ mixin(Collection, {
|
|
|
4882
4980
|
},
|
|
4883
4981
|
|
|
4884
4982
|
findLastKey: function findLastKey(predicate, context) {
|
|
4885
|
-
return this.toKeyedSeq()
|
|
4886
|
-
.reverse()
|
|
4887
|
-
.findKey(predicate, context);
|
|
4983
|
+
return this.toKeyedSeq().reverse().findKey(predicate, context);
|
|
4888
4984
|
},
|
|
4889
4985
|
|
|
4890
4986
|
first: function first(notSetValue) {
|
|
@@ -4907,7 +5003,7 @@ mixin(Collection, {
|
|
|
4907
5003
|
return this.find(function (_, key) { return is(key, searchKey); }, undefined, notSetValue);
|
|
4908
5004
|
},
|
|
4909
5005
|
|
|
4910
|
-
getIn: getIn
|
|
5006
|
+
getIn: getIn,
|
|
4911
5007
|
|
|
4912
5008
|
groupBy: function groupBy(grouper, context) {
|
|
4913
5009
|
return groupByFactory(this, grouper, context);
|
|
@@ -4917,7 +5013,7 @@ mixin(Collection, {
|
|
|
4917
5013
|
return this.get(searchKey, NOT_SET) !== NOT_SET;
|
|
4918
5014
|
},
|
|
4919
5015
|
|
|
4920
|
-
hasIn: hasIn
|
|
5016
|
+
hasIn: hasIn,
|
|
4921
5017
|
|
|
4922
5018
|
isSubset: function isSubset(iter) {
|
|
4923
5019
|
iter = typeof iter.includes === 'function' ? iter : Collection(iter);
|
|
@@ -4934,21 +5030,15 @@ mixin(Collection, {
|
|
|
4934
5030
|
},
|
|
4935
5031
|
|
|
4936
5032
|
keySeq: function keySeq() {
|
|
4937
|
-
return this.toSeq()
|
|
4938
|
-
.map(keyMapper)
|
|
4939
|
-
.toIndexedSeq();
|
|
5033
|
+
return this.toSeq().map(keyMapper).toIndexedSeq();
|
|
4940
5034
|
},
|
|
4941
5035
|
|
|
4942
5036
|
last: function last(notSetValue) {
|
|
4943
|
-
return this.toSeq()
|
|
4944
|
-
.reverse()
|
|
4945
|
-
.first(notSetValue);
|
|
5037
|
+
return this.toSeq().reverse().first(notSetValue);
|
|
4946
5038
|
},
|
|
4947
5039
|
|
|
4948
5040
|
lastKeyOf: function lastKeyOf(searchValue) {
|
|
4949
|
-
return this.toKeyedSeq()
|
|
4950
|
-
.reverse()
|
|
4951
|
-
.keyOf(searchValue);
|
|
5041
|
+
return this.toKeyedSeq().reverse().keyOf(searchValue);
|
|
4952
5042
|
},
|
|
4953
5043
|
|
|
4954
5044
|
max: function max(comparator) {
|
|
@@ -5040,7 +5130,7 @@ CollectionPrototype[IS_COLLECTION_SYMBOL] = true;
|
|
|
5040
5130
|
CollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.values;
|
|
5041
5131
|
CollectionPrototype.toJSON = CollectionPrototype.toArray;
|
|
5042
5132
|
CollectionPrototype.__toStringMapper = quoteString;
|
|
5043
|
-
CollectionPrototype.inspect = CollectionPrototype.toSource = function() {
|
|
5133
|
+
CollectionPrototype.inspect = CollectionPrototype.toSource = function () {
|
|
5044
5134
|
return this.toString();
|
|
5045
5135
|
};
|
|
5046
5136
|
CollectionPrototype.chain = CollectionPrototype.flatMap;
|
|
@@ -5054,25 +5144,25 @@ mixin(KeyedCollection, {
|
|
|
5054
5144
|
},
|
|
5055
5145
|
|
|
5056
5146
|
mapEntries: function mapEntries(mapper, context) {
|
|
5057
|
-
var this$1 = this;
|
|
5147
|
+
var this$1$1 = this;
|
|
5058
5148
|
|
|
5059
5149
|
var iterations = 0;
|
|
5060
5150
|
return reify(
|
|
5061
5151
|
this,
|
|
5062
5152
|
this.toSeq()
|
|
5063
|
-
.map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1); })
|
|
5153
|
+
.map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1$1); })
|
|
5064
5154
|
.fromEntrySeq()
|
|
5065
5155
|
);
|
|
5066
5156
|
},
|
|
5067
5157
|
|
|
5068
5158
|
mapKeys: function mapKeys(mapper, context) {
|
|
5069
|
-
var this$1 = this;
|
|
5159
|
+
var this$1$1 = this;
|
|
5070
5160
|
|
|
5071
5161
|
return reify(
|
|
5072
5162
|
this,
|
|
5073
5163
|
this.toSeq()
|
|
5074
5164
|
.flip()
|
|
5075
|
-
.map(function (k, v) { return mapper.call(context, k, v, this$1); })
|
|
5165
|
+
.map(function (k, v) { return mapper.call(context, k, v, this$1$1); })
|
|
5076
5166
|
.flip()
|
|
5077
5167
|
);
|
|
5078
5168
|
},
|
|
@@ -5157,7 +5247,8 @@ mixin(IndexedCollection, {
|
|
|
5157
5247
|
get: function get(index, notSetValue) {
|
|
5158
5248
|
index = wrapIndex(this, index);
|
|
5159
5249
|
return index < 0 ||
|
|
5160
|
-
|
|
5250
|
+
this.size === Infinity ||
|
|
5251
|
+
(this.size !== undefined && index > this.size)
|
|
5161
5252
|
? notSetValue
|
|
5162
5253
|
: this.find(function (_, key) { return key === index; }, undefined, notSetValue);
|
|
5163
5254
|
},
|
|
@@ -5237,14 +5328,16 @@ mixin(SetCollection, {
|
|
|
5237
5328
|
},
|
|
5238
5329
|
});
|
|
5239
5330
|
|
|
5240
|
-
|
|
5241
|
-
|
|
5331
|
+
var SetCollectionPrototype = SetCollection.prototype;
|
|
5332
|
+
SetCollectionPrototype.has = CollectionPrototype.includes;
|
|
5333
|
+
SetCollectionPrototype.contains = SetCollectionPrototype.includes;
|
|
5334
|
+
SetCollectionPrototype.keys = SetCollectionPrototype.values;
|
|
5242
5335
|
|
|
5243
5336
|
// Mixin subclasses
|
|
5244
5337
|
|
|
5245
|
-
mixin(KeyedSeq,
|
|
5246
|
-
mixin(IndexedSeq,
|
|
5247
|
-
mixin(SetSeq,
|
|
5338
|
+
mixin(KeyedSeq, KeyedCollectionPrototype);
|
|
5339
|
+
mixin(IndexedSeq, IndexedCollectionPrototype);
|
|
5340
|
+
mixin(SetSeq, SetCollectionPrototype);
|
|
5248
5341
|
|
|
5249
5342
|
// #pragma Helper functions
|
|
5250
5343
|
|
|
@@ -5270,13 +5363,13 @@ function entryMapper(v, k) {
|
|
|
5270
5363
|
}
|
|
5271
5364
|
|
|
5272
5365
|
function not(predicate) {
|
|
5273
|
-
return function() {
|
|
5366
|
+
return function () {
|
|
5274
5367
|
return !predicate.apply(this, arguments);
|
|
5275
5368
|
};
|
|
5276
5369
|
}
|
|
5277
5370
|
|
|
5278
5371
|
function neg(predicate) {
|
|
5279
|
-
return function() {
|
|
5372
|
+
return function () {
|
|
5280
5373
|
return -predicate.apply(this, arguments);
|
|
5281
5374
|
};
|
|
5282
5375
|
}
|
|
@@ -5306,12 +5399,12 @@ function hashCollection(collection) {
|
|
|
5306
5399
|
h = (h + hashMerge(hash(v), hash(k))) | 0;
|
|
5307
5400
|
}
|
|
5308
5401
|
: ordered
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5402
|
+
? function (v) {
|
|
5403
|
+
h = (31 * h + hash(v)) | 0;
|
|
5404
|
+
}
|
|
5405
|
+
: function (v) {
|
|
5406
|
+
h = (h + hash(v)) | 0;
|
|
5407
|
+
}
|
|
5315
5408
|
);
|
|
5316
5409
|
return murmurHashOfSize(size, h);
|
|
5317
5410
|
}
|
|
@@ -5331,21 +5424,21 @@ function hashMerge(a, b) {
|
|
|
5331
5424
|
return (a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2))) | 0; // int
|
|
5332
5425
|
}
|
|
5333
5426
|
|
|
5334
|
-
var OrderedSet = (function (Set
|
|
5427
|
+
var OrderedSet = /*@__PURE__*/(function (Set) {
|
|
5335
5428
|
function OrderedSet(value) {
|
|
5336
5429
|
return value === null || value === undefined
|
|
5337
5430
|
? emptyOrderedSet()
|
|
5338
5431
|
: isOrderedSet(value)
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5432
|
+
? value
|
|
5433
|
+
: emptyOrderedSet().withMutations(function (set) {
|
|
5434
|
+
var iter = SetCollection(value);
|
|
5435
|
+
assertNotInfinite(iter.size);
|
|
5436
|
+
iter.forEach(function (v) { return set.add(v); });
|
|
5437
|
+
});
|
|
5345
5438
|
}
|
|
5346
5439
|
|
|
5347
|
-
if ( Set
|
|
5348
|
-
OrderedSet.prototype = Object.create( Set
|
|
5440
|
+
if ( Set ) OrderedSet.__proto__ = Set;
|
|
5441
|
+
OrderedSet.prototype = Object.create( Set && Set.prototype );
|
|
5349
5442
|
OrderedSet.prototype.constructor = OrderedSet;
|
|
5350
5443
|
|
|
5351
5444
|
OrderedSet.of = function of (/*...values*/) {
|
|
@@ -5369,6 +5462,7 @@ var OrderedSetPrototype = OrderedSet.prototype;
|
|
|
5369
5462
|
OrderedSetPrototype[IS_ORDERED_SYMBOL] = true;
|
|
5370
5463
|
OrderedSetPrototype.zip = IndexedCollectionPrototype.zip;
|
|
5371
5464
|
OrderedSetPrototype.zipWith = IndexedCollectionPrototype.zipWith;
|
|
5465
|
+
OrderedSetPrototype.zipAll = IndexedCollectionPrototype.zipAll;
|
|
5372
5466
|
|
|
5373
5467
|
OrderedSetPrototype.__empty = emptyOrderedSet;
|
|
5374
5468
|
OrderedSetPrototype.__make = makeOrderedSet;
|
|
@@ -5388,11 +5482,33 @@ function emptyOrderedSet() {
|
|
|
5388
5482
|
);
|
|
5389
5483
|
}
|
|
5390
5484
|
|
|
5485
|
+
function throwOnInvalidDefaultValues(defaultValues) {
|
|
5486
|
+
if (isRecord(defaultValues)) {
|
|
5487
|
+
throw new Error(
|
|
5488
|
+
'Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.'
|
|
5489
|
+
);
|
|
5490
|
+
}
|
|
5491
|
+
|
|
5492
|
+
if (isImmutable(defaultValues)) {
|
|
5493
|
+
throw new Error(
|
|
5494
|
+
'Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.'
|
|
5495
|
+
);
|
|
5496
|
+
}
|
|
5497
|
+
|
|
5498
|
+
if (defaultValues === null || typeof defaultValues !== 'object') {
|
|
5499
|
+
throw new Error(
|
|
5500
|
+
'Can not call `Record` with a non-object as default values. Use a plain javascript object instead.'
|
|
5501
|
+
);
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5504
|
+
|
|
5391
5505
|
var Record = function Record(defaultValues, name) {
|
|
5392
5506
|
var hasInitialized;
|
|
5393
5507
|
|
|
5508
|
+
throwOnInvalidDefaultValues(defaultValues);
|
|
5509
|
+
|
|
5394
5510
|
var RecordType = function Record(values) {
|
|
5395
|
-
var this$1 = this;
|
|
5511
|
+
var this$1$1 = this;
|
|
5396
5512
|
|
|
5397
5513
|
if (values instanceof RecordType) {
|
|
5398
5514
|
return values;
|
|
@@ -5404,6 +5520,9 @@ var Record = function Record(defaultValues, name) {
|
|
|
5404
5520
|
hasInitialized = true;
|
|
5405
5521
|
var keys = Object.keys(defaultValues);
|
|
5406
5522
|
var indices = (RecordTypePrototype._indices = {});
|
|
5523
|
+
// Deprecated: left to attempt not to break any external code which
|
|
5524
|
+
// relies on a ._name property existing on record instances.
|
|
5525
|
+
// Use Record.getDescriptiveName() instead
|
|
5407
5526
|
RecordTypePrototype._name = name;
|
|
5408
5527
|
RecordTypePrototype._keys = keys;
|
|
5409
5528
|
RecordTypePrototype._defaultValues = defaultValues;
|
|
@@ -5416,7 +5535,7 @@ var Record = function Record(defaultValues, name) {
|
|
|
5416
5535
|
console.warn &&
|
|
5417
5536
|
console.warn(
|
|
5418
5537
|
'Cannot define ' +
|
|
5419
|
-
recordName(this
|
|
5538
|
+
recordName(this) +
|
|
5420
5539
|
' with property "' +
|
|
5421
5540
|
propName +
|
|
5422
5541
|
'" since that property name is part of the Record API.'
|
|
@@ -5429,40 +5548,39 @@ var Record = function Record(defaultValues, name) {
|
|
|
5429
5548
|
}
|
|
5430
5549
|
this.__ownerID = undefined;
|
|
5431
5550
|
this._values = List().withMutations(function (l) {
|
|
5432
|
-
l.setSize(this$1._keys.length);
|
|
5551
|
+
l.setSize(this$1$1._keys.length);
|
|
5433
5552
|
KeyedCollection(values).forEach(function (v, k) {
|
|
5434
|
-
l.set(this$1._indices[k], v === this$1._defaultValues[k] ? undefined : v);
|
|
5553
|
+
l.set(this$1$1._indices[k], v === this$1$1._defaultValues[k] ? undefined : v);
|
|
5435
5554
|
});
|
|
5436
5555
|
});
|
|
5556
|
+
return this;
|
|
5437
5557
|
};
|
|
5438
5558
|
|
|
5439
|
-
var RecordTypePrototype = (RecordType.prototype =
|
|
5440
|
-
RecordPrototype
|
|
5441
|
-
));
|
|
5559
|
+
var RecordTypePrototype = (RecordType.prototype =
|
|
5560
|
+
Object.create(RecordPrototype));
|
|
5442
5561
|
RecordTypePrototype.constructor = RecordType;
|
|
5443
5562
|
|
|
5563
|
+
if (name) {
|
|
5564
|
+
RecordType.displayName = name;
|
|
5565
|
+
}
|
|
5566
|
+
|
|
5444
5567
|
return RecordType;
|
|
5445
5568
|
};
|
|
5446
5569
|
|
|
5447
5570
|
Record.prototype.toString = function toString () {
|
|
5448
|
-
var this$1 = this;
|
|
5449
|
-
|
|
5450
5571
|
var str = recordName(this) + ' { ';
|
|
5451
5572
|
var keys = this._keys;
|
|
5452
5573
|
var k;
|
|
5453
5574
|
for (var i = 0, l = keys.length; i !== l; i++) {
|
|
5454
5575
|
k = keys[i];
|
|
5455
|
-
str += (i ? ', ' : '') + k + ': ' + quoteString(this
|
|
5576
|
+
str += (i ? ', ' : '') + k + ': ' + quoteString(this.get(k));
|
|
5456
5577
|
}
|
|
5457
5578
|
return str + ' }';
|
|
5458
5579
|
};
|
|
5459
5580
|
|
|
5460
5581
|
Record.prototype.equals = function equals (other) {
|
|
5461
5582
|
return (
|
|
5462
|
-
this === other ||
|
|
5463
|
-
(other &&
|
|
5464
|
-
this._keys === other._keys &&
|
|
5465
|
-
recordSeq(this).equals(recordSeq(other)))
|
|
5583
|
+
this === other || (other && recordSeq(this).equals(recordSeq(other)))
|
|
5466
5584
|
);
|
|
5467
5585
|
};
|
|
5468
5586
|
|
|
@@ -5506,6 +5624,7 @@ Record.prototype.remove = function remove (k) {
|
|
|
5506
5624
|
|
|
5507
5625
|
Record.prototype.clear = function clear () {
|
|
5508
5626
|
var newValues = this._values.clear().setSize(this._keys.length);
|
|
5627
|
+
|
|
5509
5628
|
return this.__ownerID ? this : makeRecord(this, newValues);
|
|
5510
5629
|
};
|
|
5511
5630
|
|
|
@@ -5552,24 +5671,24 @@ var RecordPrototype = Record.prototype;
|
|
|
5552
5671
|
RecordPrototype[IS_RECORD_SYMBOL] = true;
|
|
5553
5672
|
RecordPrototype[DELETE] = RecordPrototype.remove;
|
|
5554
5673
|
RecordPrototype.deleteIn = RecordPrototype.removeIn = deleteIn;
|
|
5555
|
-
RecordPrototype.getIn = getIn
|
|
5674
|
+
RecordPrototype.getIn = getIn;
|
|
5556
5675
|
RecordPrototype.hasIn = CollectionPrototype.hasIn;
|
|
5557
|
-
RecordPrototype.merge = merge;
|
|
5558
|
-
RecordPrototype.mergeWith = mergeWith;
|
|
5676
|
+
RecordPrototype.merge = merge$1;
|
|
5677
|
+
RecordPrototype.mergeWith = mergeWith$1;
|
|
5559
5678
|
RecordPrototype.mergeIn = mergeIn;
|
|
5560
|
-
RecordPrototype.mergeDeep = mergeDeep
|
|
5561
|
-
RecordPrototype.mergeDeepWith = mergeDeepWith
|
|
5679
|
+
RecordPrototype.mergeDeep = mergeDeep;
|
|
5680
|
+
RecordPrototype.mergeDeepWith = mergeDeepWith;
|
|
5562
5681
|
RecordPrototype.mergeDeepIn = mergeDeepIn;
|
|
5563
|
-
RecordPrototype.setIn = setIn
|
|
5564
|
-
RecordPrototype.update = update
|
|
5565
|
-
RecordPrototype.updateIn = updateIn
|
|
5682
|
+
RecordPrototype.setIn = setIn;
|
|
5683
|
+
RecordPrototype.update = update;
|
|
5684
|
+
RecordPrototype.updateIn = updateIn;
|
|
5566
5685
|
RecordPrototype.withMutations = withMutations;
|
|
5567
5686
|
RecordPrototype.asMutable = asMutable;
|
|
5568
5687
|
RecordPrototype.asImmutable = asImmutable;
|
|
5569
5688
|
RecordPrototype[ITERATOR_SYMBOL] = RecordPrototype.entries;
|
|
5570
5689
|
RecordPrototype.toJSON = RecordPrototype.toObject =
|
|
5571
5690
|
CollectionPrototype.toObject;
|
|
5572
|
-
RecordPrototype.inspect = RecordPrototype.toSource = function() {
|
|
5691
|
+
RecordPrototype.inspect = RecordPrototype.toSource = function () {
|
|
5573
5692
|
return this.toString();
|
|
5574
5693
|
};
|
|
5575
5694
|
|
|
@@ -5581,7 +5700,7 @@ function makeRecord(likeRecord, values, ownerID) {
|
|
|
5581
5700
|
}
|
|
5582
5701
|
|
|
5583
5702
|
function recordName(record) {
|
|
5584
|
-
return record.
|
|
5703
|
+
return record.constructor.displayName || record.constructor.name || 'Record';
|
|
5585
5704
|
}
|
|
5586
5705
|
|
|
5587
5706
|
function recordSeq(record) {
|
|
@@ -5591,10 +5710,10 @@ function recordSeq(record) {
|
|
|
5591
5710
|
function setProp(prototype, name) {
|
|
5592
5711
|
try {
|
|
5593
5712
|
Object.defineProperty(prototype, name, {
|
|
5594
|
-
get: function() {
|
|
5713
|
+
get: function () {
|
|
5595
5714
|
return this.get(name);
|
|
5596
5715
|
},
|
|
5597
|
-
set: function(value) {
|
|
5716
|
+
set: function (value) {
|
|
5598
5717
|
invariant(this.__ownerID, 'Cannot set on an immutable record.');
|
|
5599
5718
|
this.set(name, value);
|
|
5600
5719
|
},
|
|
@@ -5608,7 +5727,7 @@ function setProp(prototype, name) {
|
|
|
5608
5727
|
* Returns a lazy Seq of `value` repeated `times` times. When `times` is
|
|
5609
5728
|
* undefined, returns an infinite sequence of `value`.
|
|
5610
5729
|
*/
|
|
5611
|
-
var Repeat = (function (IndexedSeq
|
|
5730
|
+
var Repeat = /*@__PURE__*/(function (IndexedSeq) {
|
|
5612
5731
|
function Repeat(value, times) {
|
|
5613
5732
|
if (!(this instanceof Repeat)) {
|
|
5614
5733
|
return new Repeat(value, times);
|
|
@@ -5623,8 +5742,8 @@ var Repeat = (function (IndexedSeq$$1) {
|
|
|
5623
5742
|
}
|
|
5624
5743
|
}
|
|
5625
5744
|
|
|
5626
|
-
if ( IndexedSeq
|
|
5627
|
-
Repeat.prototype = Object.create( IndexedSeq
|
|
5745
|
+
if ( IndexedSeq ) Repeat.__proto__ = IndexedSeq;
|
|
5746
|
+
Repeat.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
|
|
5628
5747
|
Repeat.prototype.constructor = Repeat;
|
|
5629
5748
|
|
|
5630
5749
|
Repeat.prototype.toString = function toString () {
|
|
@@ -5671,12 +5790,10 @@ var Repeat = (function (IndexedSeq$$1) {
|
|
|
5671
5790
|
};
|
|
5672
5791
|
|
|
5673
5792
|
Repeat.prototype.__iterate = function __iterate (fn, reverse) {
|
|
5674
|
-
var this$1 = this;
|
|
5675
|
-
|
|
5676
5793
|
var size = this.size;
|
|
5677
5794
|
var i = 0;
|
|
5678
5795
|
while (i !== size) {
|
|
5679
|
-
if (fn(this
|
|
5796
|
+
if (fn(this._value, reverse ? size - ++i : i++, this) === false) {
|
|
5680
5797
|
break;
|
|
5681
5798
|
}
|
|
5682
5799
|
}
|
|
@@ -5684,14 +5801,13 @@ var Repeat = (function (IndexedSeq$$1) {
|
|
|
5684
5801
|
};
|
|
5685
5802
|
|
|
5686
5803
|
Repeat.prototype.__iterator = function __iterator (type, reverse) {
|
|
5687
|
-
var this$1 = this;
|
|
5804
|
+
var this$1$1 = this;
|
|
5688
5805
|
|
|
5689
5806
|
var size = this.size;
|
|
5690
5807
|
var i = 0;
|
|
5691
|
-
return new Iterator(
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
: iteratorValue(type, reverse ? size - ++i : i++, this$1._value); }
|
|
5808
|
+
return new Iterator(function () { return i === size
|
|
5809
|
+
? iteratorDone()
|
|
5810
|
+
: iteratorValue(type, reverse ? size - ++i : i++, this$1$1._value); }
|
|
5695
5811
|
);
|
|
5696
5812
|
};
|
|
5697
5813
|
|
|
@@ -5718,12 +5834,11 @@ function fromJS(value, converter) {
|
|
|
5718
5834
|
}
|
|
5719
5835
|
|
|
5720
5836
|
function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
if (toSeq) {
|
|
5837
|
+
if (
|
|
5838
|
+
typeof value !== 'string' &&
|
|
5839
|
+
!isImmutable(value) &&
|
|
5840
|
+
(isArrayLike(value) || hasIterator(value) || isPlainObject(value))
|
|
5841
|
+
) {
|
|
5727
5842
|
if (~stack.indexOf(value)) {
|
|
5728
5843
|
throw new TypeError('Cannot convert circular structure to Immutable');
|
|
5729
5844
|
}
|
|
@@ -5732,7 +5847,7 @@ function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
|
|
|
5732
5847
|
var converted = converter.call(
|
|
5733
5848
|
parentValue,
|
|
5734
5849
|
key,
|
|
5735
|
-
|
|
5850
|
+
Seq(value).map(function (v, k) { return fromJSWith(stack, converter, v, k, keyPath, value); }
|
|
5736
5851
|
),
|
|
5737
5852
|
keyPath && keyPath.slice()
|
|
5738
5853
|
);
|
|
@@ -5744,10 +5859,11 @@ function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
|
|
|
5744
5859
|
}
|
|
5745
5860
|
|
|
5746
5861
|
function defaultConverter(k, v) {
|
|
5747
|
-
|
|
5862
|
+
// Effectively the opposite of "Collection.toSeq()"
|
|
5863
|
+
return isIndexed(v) ? v.toList() : isKeyed(v) ? v.toMap() : v.toSet();
|
|
5748
5864
|
}
|
|
5749
5865
|
|
|
5750
|
-
var version = "4.0.0-rc.
|
|
5866
|
+
var version = "4.0.0-rc.15";
|
|
5751
5867
|
|
|
5752
5868
|
var Immutable = {
|
|
5753
5869
|
version: version,
|
|
@@ -5779,6 +5895,7 @@ var Immutable = {
|
|
|
5779
5895
|
isAssociative: isAssociative,
|
|
5780
5896
|
isOrdered: isOrdered,
|
|
5781
5897
|
isValueObject: isValueObject,
|
|
5898
|
+
isPlainObject: isPlainObject,
|
|
5782
5899
|
isSeq: isSeq,
|
|
5783
5900
|
isList: isList,
|
|
5784
5901
|
isMap: isMap,
|
|
@@ -5789,23 +5906,23 @@ var Immutable = {
|
|
|
5789
5906
|
isRecord: isRecord,
|
|
5790
5907
|
|
|
5791
5908
|
get: get,
|
|
5792
|
-
getIn: getIn,
|
|
5909
|
+
getIn: getIn$1,
|
|
5793
5910
|
has: has,
|
|
5794
|
-
hasIn: hasIn,
|
|
5795
|
-
merge: merge
|
|
5796
|
-
mergeDeep: mergeDeep,
|
|
5797
|
-
mergeWith: mergeWith
|
|
5798
|
-
mergeDeepWith: mergeDeepWith,
|
|
5911
|
+
hasIn: hasIn$1,
|
|
5912
|
+
merge: merge,
|
|
5913
|
+
mergeDeep: mergeDeep$1,
|
|
5914
|
+
mergeWith: mergeWith,
|
|
5915
|
+
mergeDeepWith: mergeDeepWith$1,
|
|
5799
5916
|
remove: remove,
|
|
5800
5917
|
removeIn: removeIn,
|
|
5801
5918
|
set: set,
|
|
5802
|
-
setIn: setIn,
|
|
5803
|
-
update: update,
|
|
5804
|
-
updateIn: updateIn,
|
|
5919
|
+
setIn: setIn$1,
|
|
5920
|
+
update: update$1,
|
|
5921
|
+
updateIn: updateIn$1,
|
|
5805
5922
|
};
|
|
5806
5923
|
|
|
5807
5924
|
// Note: Iterable is deprecated
|
|
5808
5925
|
var Iterable = Collection;
|
|
5809
5926
|
|
|
5810
5927
|
export default Immutable;
|
|
5811
|
-
export {
|
|
5928
|
+
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 };
|