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