immutable 4.3.7 → 5.0.3
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/README.md +4 -4
- package/dist/immutable.d.ts +260 -67
- package/dist/immutable.es.js +40 -92
- package/dist/immutable.js +42 -96
- package/dist/immutable.js.flow +13 -11
- package/dist/immutable.min.js +2 -32
- package/package.json +1 -2
package/dist/immutable.es.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @license
|
|
2
3
|
* MIT License
|
|
3
4
|
*
|
|
4
5
|
* Copyright (c) 2014-present, Lee Byron and other contributors.
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
23
|
* SOFTWARE.
|
|
23
24
|
*/
|
|
25
|
+
// Used for setting prototype methods that IE8 chokes on.
|
|
24
26
|
var DELETE = 'delete';
|
|
25
27
|
|
|
26
28
|
// Constants describing the size of trie nodes.
|
|
@@ -112,6 +114,7 @@ function isNeg(value) {
|
|
|
112
114
|
return value < 0 || (value === 0 && 1 / value === -Infinity);
|
|
113
115
|
}
|
|
114
116
|
|
|
117
|
+
// Note: value is unchanged to not break immutable-devtools.
|
|
115
118
|
var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
|
|
116
119
|
|
|
117
120
|
function isCollection(maybeCollection) {
|
|
@@ -1937,6 +1940,7 @@ function defaultComparator(a, b) {
|
|
|
1937
1940
|
return a > b ? 1 : a < b ? -1 : 0;
|
|
1938
1941
|
}
|
|
1939
1942
|
|
|
1943
|
+
// http://jsperf.com/copy-array-inline
|
|
1940
1944
|
function arrCopy(arr, offset) {
|
|
1941
1945
|
offset = offset || 0;
|
|
1942
1946
|
var len = Math.max(0, arr.length - offset);
|
|
@@ -2008,6 +2012,9 @@ function isDataStructure(value) {
|
|
|
2008
2012
|
);
|
|
2009
2013
|
}
|
|
2010
2014
|
|
|
2015
|
+
/**
|
|
2016
|
+
* Converts a value to a string, adding quotes if a string was provided.
|
|
2017
|
+
*/
|
|
2011
2018
|
function quoteString(value) {
|
|
2012
2019
|
try {
|
|
2013
2020
|
return typeof value === 'string' ? JSON.stringify(value) : String(value);
|
|
@@ -2400,20 +2407,6 @@ var Map = /*@__PURE__*/(function (KeyedCollection) {
|
|
|
2400
2407
|
Map.prototype = Object.create( KeyedCollection && KeyedCollection.prototype );
|
|
2401
2408
|
Map.prototype.constructor = Map;
|
|
2402
2409
|
|
|
2403
|
-
Map.of = function of () {
|
|
2404
|
-
var keyValues = [], len = arguments.length;
|
|
2405
|
-
while ( len-- ) keyValues[ len ] = arguments[ len ];
|
|
2406
|
-
|
|
2407
|
-
return emptyMap().withMutations(function (map) {
|
|
2408
|
-
for (var i = 0; i < keyValues.length; i += 2) {
|
|
2409
|
-
if (i + 1 >= keyValues.length) {
|
|
2410
|
-
throw new Error('Missing value for key: ' + keyValues[i]);
|
|
2411
|
-
}
|
|
2412
|
-
map.set(keyValues[i], keyValues[i + 1]);
|
|
2413
|
-
}
|
|
2414
|
-
});
|
|
2415
|
-
};
|
|
2416
|
-
|
|
2417
2410
|
Map.prototype.toString = function toString () {
|
|
2418
2411
|
return this.__toString('Map {', '}');
|
|
2419
2412
|
};
|
|
@@ -2903,7 +2896,7 @@ BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate =
|
|
|
2903
2896
|
}
|
|
2904
2897
|
};
|
|
2905
2898
|
|
|
2906
|
-
// eslint-disable-next-line no-unused-vars
|
|
2899
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2907
2900
|
ValueNode.prototype.iterate = function (fn, reverse) {
|
|
2908
2901
|
return fn(this.entry);
|
|
2909
2902
|
};
|
|
@@ -3425,7 +3418,10 @@ var VNode = function VNode(array, ownerID) {
|
|
|
3425
3418
|
// TODO: seems like these methods are very similar
|
|
3426
3419
|
|
|
3427
3420
|
VNode.prototype.removeBefore = function removeBefore (ownerID, level, index) {
|
|
3428
|
-
if (
|
|
3421
|
+
if (
|
|
3422
|
+
(index & ((1 << (level + SHIFT)) - 1)) === 0 ||
|
|
3423
|
+
this.array.length === 0
|
|
3424
|
+
) {
|
|
3429
3425
|
return this;
|
|
3430
3426
|
}
|
|
3431
3427
|
var originIndex = (index >>> level) & MASK;
|
|
@@ -3458,7 +3454,10 @@ VNode.prototype.removeBefore = function removeBefore (ownerID, level, index) {
|
|
|
3458
3454
|
};
|
|
3459
3455
|
|
|
3460
3456
|
VNode.prototype.removeAfter = function removeAfter (ownerID, level, index) {
|
|
3461
|
-
if (
|
|
3457
|
+
if (
|
|
3458
|
+
index === (level ? 1 << (level + SHIFT) : SIZE) ||
|
|
3459
|
+
this.array.length === 0
|
|
3460
|
+
) {
|
|
3462
3461
|
return this;
|
|
3463
3462
|
}
|
|
3464
3463
|
var sizeIndex = ((index - 1) >>> level) & MASK;
|
|
@@ -3561,9 +3560,8 @@ function makeList(origin, capacity, level, root, tail, ownerID, hash) {
|
|
|
3561
3560
|
return list;
|
|
3562
3561
|
}
|
|
3563
3562
|
|
|
3564
|
-
var EMPTY_LIST;
|
|
3565
3563
|
function emptyList() {
|
|
3566
|
-
return
|
|
3564
|
+
return makeList(0, 0, SHIFT);
|
|
3567
3565
|
}
|
|
3568
3566
|
|
|
3569
3567
|
function updateList(list, index, value) {
|
|
@@ -4299,6 +4297,9 @@ function deepEqual(a, b) {
|
|
|
4299
4297
|
return allEqual && a.size === bSize;
|
|
4300
4298
|
}
|
|
4301
4299
|
|
|
4300
|
+
/**
|
|
4301
|
+
* Contributes additional methods to a constructor
|
|
4302
|
+
*/
|
|
4302
4303
|
function mixin(ctor, methods) {
|
|
4303
4304
|
var keyCopier = function (key) {
|
|
4304
4305
|
ctor.prototype[key] = methods[key];
|
|
@@ -4582,16 +4583,23 @@ function emptySet() {
|
|
|
4582
4583
|
*/
|
|
4583
4584
|
var Range = /*@__PURE__*/(function (IndexedSeq) {
|
|
4584
4585
|
function Range(start, end, step) {
|
|
4586
|
+
if ( step === void 0 ) step = 1;
|
|
4587
|
+
|
|
4585
4588
|
if (!(this instanceof Range)) {
|
|
4586
4589
|
// eslint-disable-next-line no-constructor-return
|
|
4587
4590
|
return new Range(start, end, step);
|
|
4588
4591
|
}
|
|
4589
4592
|
invariant(step !== 0, 'Cannot step a Range by 0');
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4593
|
+
invariant(
|
|
4594
|
+
start !== undefined,
|
|
4595
|
+
'You must define a start value when using Range'
|
|
4596
|
+
);
|
|
4597
|
+
invariant(
|
|
4598
|
+
end !== undefined,
|
|
4599
|
+
'You must define an end value when using Range'
|
|
4600
|
+
);
|
|
4601
|
+
|
|
4602
|
+
step = Math.abs(step);
|
|
4595
4603
|
if (end < start) {
|
|
4596
4604
|
step = -step;
|
|
4597
4605
|
}
|
|
@@ -4604,6 +4612,7 @@ var Range = /*@__PURE__*/(function (IndexedSeq) {
|
|
|
4604
4612
|
// eslint-disable-next-line no-constructor-return
|
|
4605
4613
|
return EMPTY_RANGE;
|
|
4606
4614
|
}
|
|
4615
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
4607
4616
|
EMPTY_RANGE = this;
|
|
4608
4617
|
}
|
|
4609
4618
|
}
|
|
@@ -4747,13 +4756,6 @@ function toObject() {
|
|
|
4747
4756
|
return object;
|
|
4748
4757
|
}
|
|
4749
4758
|
|
|
4750
|
-
// Note: all of these methods are deprecated.
|
|
4751
|
-
Collection.isIterable = isCollection;
|
|
4752
|
-
Collection.isKeyed = isKeyed;
|
|
4753
|
-
Collection.isIndexed = isIndexed;
|
|
4754
|
-
Collection.isAssociative = isAssociative;
|
|
4755
|
-
Collection.isOrdered = isOrdered;
|
|
4756
|
-
|
|
4757
4759
|
Collection.Iterator = Iterator;
|
|
4758
4760
|
|
|
4759
4761
|
mixin(Collection, {
|
|
@@ -4988,6 +4990,7 @@ mixin(Collection, {
|
|
|
4988
4990
|
},
|
|
4989
4991
|
|
|
4990
4992
|
entrySeq: function entrySeq() {
|
|
4993
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
4991
4994
|
var collection = this;
|
|
4992
4995
|
if (collection._cache) {
|
|
4993
4996
|
// We cache as an entries array, so we can just return the cache!
|
|
@@ -5438,7 +5441,8 @@ function hashCollection(collection) {
|
|
|
5438
5441
|
var ordered = isOrdered(collection);
|
|
5439
5442
|
var keyed = isKeyed(collection);
|
|
5440
5443
|
var h = ordered ? 1 : 0;
|
|
5441
|
-
|
|
5444
|
+
|
|
5445
|
+
collection.__iterate(
|
|
5442
5446
|
keyed
|
|
5443
5447
|
? ordered
|
|
5444
5448
|
? function (v, k) {
|
|
@@ -5455,7 +5459,8 @@ function hashCollection(collection) {
|
|
|
5455
5459
|
h = (h + hash(v)) | 0;
|
|
5456
5460
|
}
|
|
5457
5461
|
);
|
|
5458
|
-
|
|
5462
|
+
|
|
5463
|
+
return murmurHashOfSize(collection.size, h);
|
|
5459
5464
|
}
|
|
5460
5465
|
|
|
5461
5466
|
function murmurHashOfSize(size, h) {
|
|
@@ -5797,6 +5802,7 @@ var Repeat = /*@__PURE__*/(function (IndexedSeq) {
|
|
|
5797
5802
|
// eslint-disable-next-line no-constructor-return
|
|
5798
5803
|
return EMPTY_REPEAT;
|
|
5799
5804
|
}
|
|
5805
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
5800
5806
|
EMPTY_REPEAT = this;
|
|
5801
5807
|
}
|
|
5802
5808
|
}
|
|
@@ -5922,67 +5928,9 @@ function defaultConverter(k, v) {
|
|
|
5922
5928
|
return isIndexed(v) ? v.toList() : isKeyed(v) ? v.toMap() : v.toSet();
|
|
5923
5929
|
}
|
|
5924
5930
|
|
|
5925
|
-
var version = "
|
|
5926
|
-
|
|
5927
|
-
var Immutable = {
|
|
5928
|
-
version: version,
|
|
5929
|
-
|
|
5930
|
-
Collection: Collection,
|
|
5931
|
-
// Note: Iterable is deprecated
|
|
5932
|
-
Iterable: Collection,
|
|
5933
|
-
|
|
5934
|
-
Seq: Seq,
|
|
5935
|
-
Map: Map,
|
|
5936
|
-
OrderedMap: OrderedMap,
|
|
5937
|
-
List: List,
|
|
5938
|
-
Stack: Stack,
|
|
5939
|
-
Set: Set,
|
|
5940
|
-
OrderedSet: OrderedSet,
|
|
5941
|
-
PairSorting: PairSorting,
|
|
5942
|
-
|
|
5943
|
-
Record: Record,
|
|
5944
|
-
Range: Range,
|
|
5945
|
-
Repeat: Repeat,
|
|
5946
|
-
|
|
5947
|
-
is: is,
|
|
5948
|
-
fromJS: fromJS,
|
|
5949
|
-
hash: hash,
|
|
5950
|
-
|
|
5951
|
-
isImmutable: isImmutable,
|
|
5952
|
-
isCollection: isCollection,
|
|
5953
|
-
isKeyed: isKeyed,
|
|
5954
|
-
isIndexed: isIndexed,
|
|
5955
|
-
isAssociative: isAssociative,
|
|
5956
|
-
isOrdered: isOrdered,
|
|
5957
|
-
isValueObject: isValueObject,
|
|
5958
|
-
isPlainObject: isPlainObject,
|
|
5959
|
-
isSeq: isSeq,
|
|
5960
|
-
isList: isList,
|
|
5961
|
-
isMap: isMap,
|
|
5962
|
-
isOrderedMap: isOrderedMap,
|
|
5963
|
-
isStack: isStack,
|
|
5964
|
-
isSet: isSet,
|
|
5965
|
-
isOrderedSet: isOrderedSet,
|
|
5966
|
-
isRecord: isRecord,
|
|
5967
|
-
|
|
5968
|
-
get: get,
|
|
5969
|
-
getIn: getIn$1,
|
|
5970
|
-
has: has,
|
|
5971
|
-
hasIn: hasIn$1,
|
|
5972
|
-
merge: merge,
|
|
5973
|
-
mergeDeep: mergeDeep$1,
|
|
5974
|
-
mergeWith: mergeWith,
|
|
5975
|
-
mergeDeepWith: mergeDeepWith$1,
|
|
5976
|
-
remove: remove,
|
|
5977
|
-
removeIn: removeIn,
|
|
5978
|
-
set: set,
|
|
5979
|
-
setIn: setIn$1,
|
|
5980
|
-
update: update$1,
|
|
5981
|
-
updateIn: updateIn$1,
|
|
5982
|
-
};
|
|
5931
|
+
var version = "5.0.3";
|
|
5983
5932
|
|
|
5984
5933
|
// Note: Iterable is deprecated
|
|
5985
5934
|
var Iterable = Collection;
|
|
5986
5935
|
|
|
5987
|
-
export default Immutable;
|
|
5988
5936
|
export { Collection, Iterable, List, Map, OrderedMap, OrderedSet, PairSorting, 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 };
|
package/dist/immutable.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @license
|
|
2
3
|
* MIT License
|
|
3
4
|
*
|
|
4
5
|
* Copyright (c) 2014-present, Lee Byron and other contributors.
|
|
@@ -25,8 +26,9 @@
|
|
|
25
26
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
26
27
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
27
28
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Immutable = {}));
|
|
28
|
-
}(this, (function (exports) { 'use strict';
|
|
29
|
+
})(this, (function (exports) { 'use strict';
|
|
29
30
|
|
|
31
|
+
// Used for setting prototype methods that IE8 chokes on.
|
|
30
32
|
var DELETE = 'delete';
|
|
31
33
|
|
|
32
34
|
// Constants describing the size of trie nodes.
|
|
@@ -118,6 +120,7 @@
|
|
|
118
120
|
return value < 0 || (value === 0 && 1 / value === -Infinity);
|
|
119
121
|
}
|
|
120
122
|
|
|
123
|
+
// Note: value is unchanged to not break immutable-devtools.
|
|
121
124
|
var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
|
|
122
125
|
|
|
123
126
|
function isCollection(maybeCollection) {
|
|
@@ -1943,6 +1946,7 @@
|
|
|
1943
1946
|
return a > b ? 1 : a < b ? -1 : 0;
|
|
1944
1947
|
}
|
|
1945
1948
|
|
|
1949
|
+
// http://jsperf.com/copy-array-inline
|
|
1946
1950
|
function arrCopy(arr, offset) {
|
|
1947
1951
|
offset = offset || 0;
|
|
1948
1952
|
var len = Math.max(0, arr.length - offset);
|
|
@@ -2014,6 +2018,9 @@
|
|
|
2014
2018
|
);
|
|
2015
2019
|
}
|
|
2016
2020
|
|
|
2021
|
+
/**
|
|
2022
|
+
* Converts a value to a string, adding quotes if a string was provided.
|
|
2023
|
+
*/
|
|
2017
2024
|
function quoteString(value) {
|
|
2018
2025
|
try {
|
|
2019
2026
|
return typeof value === 'string' ? JSON.stringify(value) : String(value);
|
|
@@ -2406,20 +2413,6 @@
|
|
|
2406
2413
|
Map.prototype = Object.create( KeyedCollection && KeyedCollection.prototype );
|
|
2407
2414
|
Map.prototype.constructor = Map;
|
|
2408
2415
|
|
|
2409
|
-
Map.of = function of () {
|
|
2410
|
-
var keyValues = [], len = arguments.length;
|
|
2411
|
-
while ( len-- ) keyValues[ len ] = arguments[ len ];
|
|
2412
|
-
|
|
2413
|
-
return emptyMap().withMutations(function (map) {
|
|
2414
|
-
for (var i = 0; i < keyValues.length; i += 2) {
|
|
2415
|
-
if (i + 1 >= keyValues.length) {
|
|
2416
|
-
throw new Error('Missing value for key: ' + keyValues[i]);
|
|
2417
|
-
}
|
|
2418
|
-
map.set(keyValues[i], keyValues[i + 1]);
|
|
2419
|
-
}
|
|
2420
|
-
});
|
|
2421
|
-
};
|
|
2422
|
-
|
|
2423
2416
|
Map.prototype.toString = function toString () {
|
|
2424
2417
|
return this.__toString('Map {', '}');
|
|
2425
2418
|
};
|
|
@@ -2909,7 +2902,7 @@
|
|
|
2909
2902
|
}
|
|
2910
2903
|
};
|
|
2911
2904
|
|
|
2912
|
-
// eslint-disable-next-line no-unused-vars
|
|
2905
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2913
2906
|
ValueNode.prototype.iterate = function (fn, reverse) {
|
|
2914
2907
|
return fn(this.entry);
|
|
2915
2908
|
};
|
|
@@ -3431,7 +3424,10 @@
|
|
|
3431
3424
|
// TODO: seems like these methods are very similar
|
|
3432
3425
|
|
|
3433
3426
|
VNode.prototype.removeBefore = function removeBefore (ownerID, level, index) {
|
|
3434
|
-
if (
|
|
3427
|
+
if (
|
|
3428
|
+
(index & ((1 << (level + SHIFT)) - 1)) === 0 ||
|
|
3429
|
+
this.array.length === 0
|
|
3430
|
+
) {
|
|
3435
3431
|
return this;
|
|
3436
3432
|
}
|
|
3437
3433
|
var originIndex = (index >>> level) & MASK;
|
|
@@ -3464,7 +3460,10 @@
|
|
|
3464
3460
|
};
|
|
3465
3461
|
|
|
3466
3462
|
VNode.prototype.removeAfter = function removeAfter (ownerID, level, index) {
|
|
3467
|
-
if (
|
|
3463
|
+
if (
|
|
3464
|
+
index === (level ? 1 << (level + SHIFT) : SIZE) ||
|
|
3465
|
+
this.array.length === 0
|
|
3466
|
+
) {
|
|
3468
3467
|
return this;
|
|
3469
3468
|
}
|
|
3470
3469
|
var sizeIndex = ((index - 1) >>> level) & MASK;
|
|
@@ -3567,9 +3566,8 @@
|
|
|
3567
3566
|
return list;
|
|
3568
3567
|
}
|
|
3569
3568
|
|
|
3570
|
-
var EMPTY_LIST;
|
|
3571
3569
|
function emptyList() {
|
|
3572
|
-
return
|
|
3570
|
+
return makeList(0, 0, SHIFT);
|
|
3573
3571
|
}
|
|
3574
3572
|
|
|
3575
3573
|
function updateList(list, index, value) {
|
|
@@ -4305,6 +4303,9 @@
|
|
|
4305
4303
|
return allEqual && a.size === bSize;
|
|
4306
4304
|
}
|
|
4307
4305
|
|
|
4306
|
+
/**
|
|
4307
|
+
* Contributes additional methods to a constructor
|
|
4308
|
+
*/
|
|
4308
4309
|
function mixin(ctor, methods) {
|
|
4309
4310
|
var keyCopier = function (key) {
|
|
4310
4311
|
ctor.prototype[key] = methods[key];
|
|
@@ -4588,16 +4589,23 @@
|
|
|
4588
4589
|
*/
|
|
4589
4590
|
var Range = /*@__PURE__*/(function (IndexedSeq) {
|
|
4590
4591
|
function Range(start, end, step) {
|
|
4592
|
+
if ( step === void 0 ) step = 1;
|
|
4593
|
+
|
|
4591
4594
|
if (!(this instanceof Range)) {
|
|
4592
4595
|
// eslint-disable-next-line no-constructor-return
|
|
4593
4596
|
return new Range(start, end, step);
|
|
4594
4597
|
}
|
|
4595
4598
|
invariant(step !== 0, 'Cannot step a Range by 0');
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4599
|
+
invariant(
|
|
4600
|
+
start !== undefined,
|
|
4601
|
+
'You must define a start value when using Range'
|
|
4602
|
+
);
|
|
4603
|
+
invariant(
|
|
4604
|
+
end !== undefined,
|
|
4605
|
+
'You must define an end value when using Range'
|
|
4606
|
+
);
|
|
4607
|
+
|
|
4608
|
+
step = Math.abs(step);
|
|
4601
4609
|
if (end < start) {
|
|
4602
4610
|
step = -step;
|
|
4603
4611
|
}
|
|
@@ -4610,6 +4618,7 @@
|
|
|
4610
4618
|
// eslint-disable-next-line no-constructor-return
|
|
4611
4619
|
return EMPTY_RANGE;
|
|
4612
4620
|
}
|
|
4621
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
4613
4622
|
EMPTY_RANGE = this;
|
|
4614
4623
|
}
|
|
4615
4624
|
}
|
|
@@ -4753,13 +4762,6 @@
|
|
|
4753
4762
|
return object;
|
|
4754
4763
|
}
|
|
4755
4764
|
|
|
4756
|
-
// Note: all of these methods are deprecated.
|
|
4757
|
-
Collection.isIterable = isCollection;
|
|
4758
|
-
Collection.isKeyed = isKeyed;
|
|
4759
|
-
Collection.isIndexed = isIndexed;
|
|
4760
|
-
Collection.isAssociative = isAssociative;
|
|
4761
|
-
Collection.isOrdered = isOrdered;
|
|
4762
|
-
|
|
4763
4765
|
Collection.Iterator = Iterator;
|
|
4764
4766
|
|
|
4765
4767
|
mixin(Collection, {
|
|
@@ -4994,6 +4996,7 @@
|
|
|
4994
4996
|
},
|
|
4995
4997
|
|
|
4996
4998
|
entrySeq: function entrySeq() {
|
|
4999
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
4997
5000
|
var collection = this;
|
|
4998
5001
|
if (collection._cache) {
|
|
4999
5002
|
// We cache as an entries array, so we can just return the cache!
|
|
@@ -5444,7 +5447,8 @@
|
|
|
5444
5447
|
var ordered = isOrdered(collection);
|
|
5445
5448
|
var keyed = isKeyed(collection);
|
|
5446
5449
|
var h = ordered ? 1 : 0;
|
|
5447
|
-
|
|
5450
|
+
|
|
5451
|
+
collection.__iterate(
|
|
5448
5452
|
keyed
|
|
5449
5453
|
? ordered
|
|
5450
5454
|
? function (v, k) {
|
|
@@ -5461,7 +5465,8 @@
|
|
|
5461
5465
|
h = (h + hash(v)) | 0;
|
|
5462
5466
|
}
|
|
5463
5467
|
);
|
|
5464
|
-
|
|
5468
|
+
|
|
5469
|
+
return murmurHashOfSize(collection.size, h);
|
|
5465
5470
|
}
|
|
5466
5471
|
|
|
5467
5472
|
function murmurHashOfSize(size, h) {
|
|
@@ -5803,6 +5808,7 @@
|
|
|
5803
5808
|
// eslint-disable-next-line no-constructor-return
|
|
5804
5809
|
return EMPTY_REPEAT;
|
|
5805
5810
|
}
|
|
5811
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
5806
5812
|
EMPTY_REPEAT = this;
|
|
5807
5813
|
}
|
|
5808
5814
|
}
|
|
@@ -5928,64 +5934,7 @@
|
|
|
5928
5934
|
return isIndexed(v) ? v.toList() : isKeyed(v) ? v.toMap() : v.toSet();
|
|
5929
5935
|
}
|
|
5930
5936
|
|
|
5931
|
-
var version = "
|
|
5932
|
-
|
|
5933
|
-
var Immutable = {
|
|
5934
|
-
version: version,
|
|
5935
|
-
|
|
5936
|
-
Collection: Collection,
|
|
5937
|
-
// Note: Iterable is deprecated
|
|
5938
|
-
Iterable: Collection,
|
|
5939
|
-
|
|
5940
|
-
Seq: Seq,
|
|
5941
|
-
Map: Map,
|
|
5942
|
-
OrderedMap: OrderedMap,
|
|
5943
|
-
List: List,
|
|
5944
|
-
Stack: Stack,
|
|
5945
|
-
Set: Set,
|
|
5946
|
-
OrderedSet: OrderedSet,
|
|
5947
|
-
PairSorting: PairSorting,
|
|
5948
|
-
|
|
5949
|
-
Record: Record,
|
|
5950
|
-
Range: Range,
|
|
5951
|
-
Repeat: Repeat,
|
|
5952
|
-
|
|
5953
|
-
is: is,
|
|
5954
|
-
fromJS: fromJS,
|
|
5955
|
-
hash: hash,
|
|
5956
|
-
|
|
5957
|
-
isImmutable: isImmutable,
|
|
5958
|
-
isCollection: isCollection,
|
|
5959
|
-
isKeyed: isKeyed,
|
|
5960
|
-
isIndexed: isIndexed,
|
|
5961
|
-
isAssociative: isAssociative,
|
|
5962
|
-
isOrdered: isOrdered,
|
|
5963
|
-
isValueObject: isValueObject,
|
|
5964
|
-
isPlainObject: isPlainObject,
|
|
5965
|
-
isSeq: isSeq,
|
|
5966
|
-
isList: isList,
|
|
5967
|
-
isMap: isMap,
|
|
5968
|
-
isOrderedMap: isOrderedMap,
|
|
5969
|
-
isStack: isStack,
|
|
5970
|
-
isSet: isSet,
|
|
5971
|
-
isOrderedSet: isOrderedSet,
|
|
5972
|
-
isRecord: isRecord,
|
|
5973
|
-
|
|
5974
|
-
get: get,
|
|
5975
|
-
getIn: getIn$1,
|
|
5976
|
-
has: has,
|
|
5977
|
-
hasIn: hasIn$1,
|
|
5978
|
-
merge: merge,
|
|
5979
|
-
mergeDeep: mergeDeep$1,
|
|
5980
|
-
mergeWith: mergeWith,
|
|
5981
|
-
mergeDeepWith: mergeDeepWith$1,
|
|
5982
|
-
remove: remove,
|
|
5983
|
-
removeIn: removeIn,
|
|
5984
|
-
set: set,
|
|
5985
|
-
setIn: setIn$1,
|
|
5986
|
-
update: update$1,
|
|
5987
|
-
updateIn: updateIn$1,
|
|
5988
|
-
};
|
|
5937
|
+
var version = "5.0.3";
|
|
5989
5938
|
|
|
5990
5939
|
// Note: Iterable is deprecated
|
|
5991
5940
|
var Iterable = Collection;
|
|
@@ -6003,7 +5952,6 @@
|
|
|
6003
5952
|
exports.Seq = Seq;
|
|
6004
5953
|
exports.Set = Set;
|
|
6005
5954
|
exports.Stack = Stack;
|
|
6006
|
-
exports.default = Immutable;
|
|
6007
5955
|
exports.fromJS = fromJS;
|
|
6008
5956
|
exports.get = get;
|
|
6009
5957
|
exports.getIn = getIn$1;
|
|
@@ -6039,6 +5987,4 @@
|
|
|
6039
5987
|
exports.updateIn = updateIn$1;
|
|
6040
5988
|
exports.version = version;
|
|
6041
5989
|
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
})));
|
|
5990
|
+
}));
|
package/dist/immutable.js.flow
CHANGED
|
@@ -76,8 +76,10 @@ declare class _Collection<K, +V> implements ValueObject {
|
|
|
76
76
|
has(key: K): boolean;
|
|
77
77
|
includes(value: V): boolean;
|
|
78
78
|
contains(value: V): boolean;
|
|
79
|
-
first
|
|
80
|
-
|
|
79
|
+
first(): V | void;
|
|
80
|
+
first<NSV>(notSetValue: NSV): V | NSV;
|
|
81
|
+
last(): V | void;
|
|
82
|
+
last<NSV>(notSetValue: NSV): V | NSV;
|
|
81
83
|
|
|
82
84
|
hasIn(keyPath: Iterable<mixed>): boolean;
|
|
83
85
|
|
|
@@ -218,16 +220,16 @@ declare class _Collection<K, +V> implements ValueObject {
|
|
|
218
220
|
context?: mixed
|
|
219
221
|
): Map<G, number>;
|
|
220
222
|
|
|
221
|
-
find
|
|
223
|
+
find(
|
|
222
224
|
predicate: (value: V, key: K, iter: this) => mixed,
|
|
223
225
|
context?: mixed,
|
|
224
|
-
notSetValue?:
|
|
225
|
-
): V |
|
|
226
|
-
findLast
|
|
226
|
+
notSetValue?: V
|
|
227
|
+
): V | void;
|
|
228
|
+
findLast(
|
|
227
229
|
predicate: (value: V, key: K, iter: this) => mixed,
|
|
228
230
|
context?: mixed,
|
|
229
|
-
notSetValue?:
|
|
230
|
-
): V |
|
|
231
|
+
notSetValue?: V
|
|
232
|
+
): V | void;
|
|
231
233
|
|
|
232
234
|
findEntry(predicate: (value: V, key: K, iter: this) => mixed): [K, V] | void;
|
|
233
235
|
findLastEntry(
|
|
@@ -936,7 +938,7 @@ declare class List<+T>
|
|
|
936
938
|
extends IndexedCollection<T>
|
|
937
939
|
mixins UpdatableInCollection<number, T>
|
|
938
940
|
{
|
|
939
|
-
static (collection?: Iterable<T>): List<T>;
|
|
941
|
+
static <T>(collection?: Iterable<T>): List<T>;
|
|
940
942
|
|
|
941
943
|
static of<T>(...values: T[]): List<T>;
|
|
942
944
|
|
|
@@ -1308,8 +1310,8 @@ declare class Set<+T> extends SetCollection<T> {
|
|
|
1308
1310
|
values: Iterable<[T, mixed]> | PlainObjInput<T, mixed>
|
|
1309
1311
|
): Set<T>;
|
|
1310
1312
|
|
|
1311
|
-
static intersect(sets: Iterable<Iterable<T>>): Set<T>;
|
|
1312
|
-
static union(sets: Iterable<Iterable<T>>): Set<T>;
|
|
1313
|
+
static intersect<T>(sets: Iterable<Iterable<T>>): Set<T>;
|
|
1314
|
+
static union<T>(sets: Iterable<Iterable<T>>): Set<T>;
|
|
1313
1315
|
|
|
1314
1316
|
static isSet: typeof isSet;
|
|
1315
1317
|
|