immutable 4.3.2 → 5.0.0-beta.1
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 +11 -7
- package/dist/es/Collection.js +74 -0
- package/dist/es/CollectionImpl.js +781 -0
- package/dist/es/Hash.js +259 -0
- package/dist/es/Immutable.js +73 -0
- package/dist/es/Iterator.js +105 -0
- package/dist/es/List.js +691 -0
- package/dist/es/Map.js +832 -0
- package/dist/es/Math.js +44 -0
- package/dist/es/Operations.js +952 -0
- package/dist/es/OrderedMap.js +194 -0
- package/dist/es/OrderedSet.js +90 -0
- package/dist/es/PairSorting.js +29 -0
- package/dist/es/Range.js +167 -0
- package/dist/es/Record.js +290 -0
- package/dist/es/Repeat.js +129 -0
- package/dist/es/Seq.js +396 -0
- package/dist/es/Set.js +277 -0
- package/dist/es/Stack.js +259 -0
- package/dist/es/TrieUtils.js +115 -0
- package/dist/es/fromJS.js +73 -0
- package/dist/es/functional/get.js +37 -0
- package/dist/es/functional/getIn.js +40 -0
- package/dist/es/functional/has.js +34 -0
- package/dist/es/functional/hasIn.js +31 -0
- package/dist/es/functional/merge.js +136 -0
- package/dist/es/functional/remove.js +55 -0
- package/dist/es/functional/removeIn.js +31 -0
- package/dist/es/functional/set.js +51 -0
- package/dist/es/functional/setIn.js +31 -0
- package/dist/es/functional/update.js +30 -0
- package/dist/es/functional/updateIn.js +93 -0
- package/dist/es/is.js +107 -0
- package/dist/es/methods/asImmutable.js +28 -0
- package/dist/es/methods/asMutable.js +30 -0
- package/dist/es/methods/deleteIn.js +30 -0
- package/dist/es/methods/getIn.js +30 -0
- package/dist/es/methods/hasIn.js +30 -0
- package/dist/es/methods/merge.js +78 -0
- package/dist/es/methods/mergeDeep.js +40 -0
- package/dist/es/methods/mergeDeepIn.js +36 -0
- package/dist/es/methods/mergeIn.js +35 -0
- package/dist/es/methods/setIn.js +30 -0
- package/dist/es/methods/toObject.js +35 -0
- package/dist/es/methods/update.js +32 -0
- package/dist/es/methods/updateIn.js +30 -0
- package/dist/es/methods/wasAltered.js +28 -0
- package/dist/es/methods/withMutations.js +30 -0
- package/dist/es/package.json.js +26 -0
- package/dist/es/predicates/isAssociative.js +31 -0
- package/dist/es/predicates/isCollection.js +30 -0
- package/dist/es/predicates/isImmutable.js +31 -0
- package/dist/es/predicates/isIndexed.js +30 -0
- package/dist/es/predicates/isKeyed.js +30 -0
- package/dist/es/predicates/isList.js +30 -0
- package/dist/es/predicates/isMap.js +30 -0
- package/dist/es/predicates/isOrdered.js +30 -0
- package/dist/es/predicates/isOrderedMap.js +31 -0
- package/dist/es/predicates/isOrderedSet.js +31 -0
- package/dist/es/predicates/isRecord.js +30 -0
- package/dist/es/predicates/isSeq.js +30 -0
- package/dist/es/predicates/isSet.js +30 -0
- package/dist/es/predicates/isStack.js +30 -0
- package/dist/es/predicates/isValueObject.js +32 -0
- package/dist/es/toJS.js +53 -0
- package/dist/es/utils/arrCopy.js +34 -0
- package/dist/es/utils/assertNotInfinite.js +33 -0
- package/dist/es/utils/coerceKeyPath.js +39 -0
- package/dist/es/utils/deepEqual.js +98 -0
- package/dist/es/utils/hasOwnProperty.js +26 -0
- package/dist/es/utils/invariant.js +28 -0
- package/dist/es/utils/isArrayLike.js +43 -0
- package/dist/es/utils/isDataStructure.js +38 -0
- package/dist/es/utils/isPlainObj.js +51 -0
- package/dist/es/utils/mixin.js +34 -0
- package/dist/es/utils/quoteString.js +32 -0
- package/dist/es/utils/shallowCopy.js +40 -0
- package/dist/immutable.d.ts +136 -21
- package/dist/immutable.js +1 -59
- package/dist/immutable.min.js +32 -32
- package/package.json +5 -3
- package/dist/immutable.es.js +0 -5965
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
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.
|
|
23
|
+
*/
|
|
24
|
+
var toString = Object.prototype.toString;
|
|
25
|
+
|
|
26
|
+
function isPlainObject(value) {
|
|
27
|
+
// The base prototype's toString deals with Argument objects and native namespaces like Math
|
|
28
|
+
if (
|
|
29
|
+
!value ||
|
|
30
|
+
typeof value !== 'object' ||
|
|
31
|
+
toString.call(value) !== '[object Object]'
|
|
32
|
+
) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var proto = Object.getPrototypeOf(value);
|
|
37
|
+
if (proto === null) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Iteratively going up the prototype chain is needed for cross-realm environments (differing contexts, iframes, etc)
|
|
42
|
+
var parentProto = proto;
|
|
43
|
+
var nextProto = Object.getPrototypeOf(proto);
|
|
44
|
+
while (nextProto !== null) {
|
|
45
|
+
parentProto = nextProto;
|
|
46
|
+
nextProto = Object.getPrototypeOf(parentProto);
|
|
47
|
+
}
|
|
48
|
+
return parentProto === proto;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default isPlainObject;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
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.
|
|
23
|
+
*/
|
|
24
|
+
function mixin(ctor, methods) {
|
|
25
|
+
var keyCopier = function (key) {
|
|
26
|
+
ctor.prototype[key] = methods[key];
|
|
27
|
+
};
|
|
28
|
+
Object.keys(methods).forEach(keyCopier);
|
|
29
|
+
Object.getOwnPropertySymbols &&
|
|
30
|
+
Object.getOwnPropertySymbols(methods).forEach(keyCopier);
|
|
31
|
+
return ctor;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default mixin;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
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.
|
|
23
|
+
*/
|
|
24
|
+
function quoteString(value) {
|
|
25
|
+
try {
|
|
26
|
+
return typeof value === 'string' ? JSON.stringify(value) : String(value);
|
|
27
|
+
} catch (_ignoreError) {
|
|
28
|
+
return JSON.stringify(value);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default quoteString;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
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.
|
|
23
|
+
*/
|
|
24
|
+
import arrCopy from './arrCopy.js';
|
|
25
|
+
import hasOwnProperty from './hasOwnProperty.js';
|
|
26
|
+
|
|
27
|
+
function shallowCopy(from) {
|
|
28
|
+
if (Array.isArray(from)) {
|
|
29
|
+
return arrCopy(from);
|
|
30
|
+
}
|
|
31
|
+
var to = {};
|
|
32
|
+
for (var key in from) {
|
|
33
|
+
if (hasOwnProperty.call(from, key)) {
|
|
34
|
+
to[key] = from[key];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return to;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default shallowCopy;
|
package/dist/immutable.d.ts
CHANGED
|
@@ -100,27 +100,30 @@ declare namespace Immutable {
|
|
|
100
100
|
export type DeepCopy<T> = T extends Record<infer R>
|
|
101
101
|
? // convert Record to DeepCopy plain JS object
|
|
102
102
|
{
|
|
103
|
-
[key in keyof R]: R[key]
|
|
103
|
+
[key in keyof R]: DeepCopy<R[key]>;
|
|
104
|
+
}
|
|
105
|
+
: T extends MapOf<infer R>
|
|
106
|
+
? // convert MapOf to DeepCopy plain JS object
|
|
107
|
+
{
|
|
108
|
+
[key in keyof R]: DeepCopy<R[key]>;
|
|
104
109
|
}
|
|
105
110
|
: T extends Collection.Keyed<infer KeyedKey, infer V>
|
|
106
111
|
? // convert KeyedCollection to DeepCopy plain JS object
|
|
107
112
|
{
|
|
108
113
|
[key in KeyedKey extends string | number | symbol
|
|
109
114
|
? KeyedKey
|
|
110
|
-
: string]: V
|
|
115
|
+
: string]: DeepCopy<V>;
|
|
111
116
|
}
|
|
112
117
|
: // convert IndexedCollection or Immutable.Set to DeepCopy plain JS array
|
|
113
118
|
T extends Collection<infer _, infer V>
|
|
114
|
-
? Array<V
|
|
119
|
+
? Array<DeepCopy<V>>
|
|
115
120
|
: T extends string | number // Iterable scalar types : should be kept as is
|
|
116
121
|
? T
|
|
117
122
|
: T extends Iterable<infer V> // Iterable are converted to plain JS array
|
|
118
|
-
? Array<V
|
|
123
|
+
? Array<DeepCopy<V>>
|
|
119
124
|
: T extends object // plain JS object are converted deeply
|
|
120
125
|
? {
|
|
121
|
-
[ObjectKey in keyof T]: T[ObjectKey]
|
|
122
|
-
? unknown
|
|
123
|
-
: T[ObjectKey];
|
|
126
|
+
[ObjectKey in keyof T]: DeepCopy<T[ObjectKey]>;
|
|
124
127
|
}
|
|
125
128
|
: // other case : should be kept as is
|
|
126
129
|
T;
|
|
@@ -831,9 +834,96 @@ declare namespace Immutable {
|
|
|
831
834
|
* not altered.
|
|
832
835
|
*/
|
|
833
836
|
function Map<K, V>(collection?: Iterable<[K, V]>): Map<K, V>;
|
|
837
|
+
function Map<R extends { [key in string | number | symbol]: unknown }>(
|
|
838
|
+
obj: R
|
|
839
|
+
): MapOf<R>;
|
|
834
840
|
function Map<V>(obj: { [key: string]: V }): Map<string, V>;
|
|
835
841
|
function Map<K extends string | symbol, V>(obj: { [P in K]?: V }): Map<K, V>;
|
|
836
842
|
|
|
843
|
+
/**
|
|
844
|
+
* Represent a Map constructed by an object
|
|
845
|
+
*
|
|
846
|
+
* @ignore
|
|
847
|
+
*/
|
|
848
|
+
interface MapOf<R extends { [key in string | number | symbol]: unknown }>
|
|
849
|
+
extends Map<keyof R, R[keyof R]> {
|
|
850
|
+
/**
|
|
851
|
+
* Returns the value associated with the provided key, or notSetValue if
|
|
852
|
+
* the Collection does not contain this key.
|
|
853
|
+
*
|
|
854
|
+
* Note: it is possible a key may be associated with an `undefined` value,
|
|
855
|
+
* so if `notSetValue` is not provided and this method returns `undefined`,
|
|
856
|
+
* that does not guarantee the key was not found.
|
|
857
|
+
*/
|
|
858
|
+
get<K extends keyof R>(key: K, notSetValue?: unknown): R[K];
|
|
859
|
+
get<NSV>(key: any, notSetValue: NSV): NSV;
|
|
860
|
+
|
|
861
|
+
// https://github.com/microsoft/TypeScript/pull/39094
|
|
862
|
+
getIn<P extends ReadonlyArray<string | number | symbol>>(
|
|
863
|
+
searchKeyPath: [...P],
|
|
864
|
+
notSetValue?: unknown
|
|
865
|
+
): RetrievePath<R, P>;
|
|
866
|
+
|
|
867
|
+
set<K extends keyof R>(key: K, value: R[K]): this;
|
|
868
|
+
|
|
869
|
+
update(updater: (value: this) => this): this;
|
|
870
|
+
update<K extends keyof R>(key: K, updater: (value: R[K]) => R[K]): this;
|
|
871
|
+
update<K extends keyof R, NSV extends R[K]>(
|
|
872
|
+
key: K,
|
|
873
|
+
notSetValue: NSV,
|
|
874
|
+
updater: (value: R[K]) => R[K]
|
|
875
|
+
): this;
|
|
876
|
+
|
|
877
|
+
// Possible best type is MapOf<Omit<R, K>> but Omit seems to broke other function calls
|
|
878
|
+
// and generate recursion error with other methods (update, merge, etc.) until those functions are defined in MapOf
|
|
879
|
+
delete<K extends keyof R>(
|
|
880
|
+
key: K
|
|
881
|
+
): Extract<R[K], undefined> extends never ? never : this;
|
|
882
|
+
remove<K extends keyof R>(
|
|
883
|
+
key: K
|
|
884
|
+
): Extract<R[K], undefined> extends never ? never : this;
|
|
885
|
+
|
|
886
|
+
toJS(): { [K in keyof R]: DeepCopy<R[K]> };
|
|
887
|
+
|
|
888
|
+
toJSON(): { [K in keyof R]: R[K] };
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
// Loosely based off of this work.
|
|
892
|
+
// https://github.com/immutable-js/immutable-js/issues/1462#issuecomment-584123268
|
|
893
|
+
|
|
894
|
+
/** @ignore */
|
|
895
|
+
type GetMapType<S> = S extends MapOf<infer T> ? T : S;
|
|
896
|
+
|
|
897
|
+
/** @ignore */
|
|
898
|
+
type Head<T extends ReadonlyArray<any>> = T extends [
|
|
899
|
+
infer H,
|
|
900
|
+
...Array<unknown>
|
|
901
|
+
]
|
|
902
|
+
? H
|
|
903
|
+
: never;
|
|
904
|
+
|
|
905
|
+
/** @ignore */
|
|
906
|
+
type Tail<T extends ReadonlyArray<any>> = T extends [unknown, ...infer I]
|
|
907
|
+
? I
|
|
908
|
+
: Array<never>;
|
|
909
|
+
|
|
910
|
+
/** @ignore */
|
|
911
|
+
type RetrievePathReducer<
|
|
912
|
+
T,
|
|
913
|
+
C,
|
|
914
|
+
L extends ReadonlyArray<any>
|
|
915
|
+
> = C extends keyof GetMapType<T>
|
|
916
|
+
? L extends []
|
|
917
|
+
? GetMapType<T>[C]
|
|
918
|
+
: RetrievePathReducer<GetMapType<T>[C], Head<L>, Tail<L>>
|
|
919
|
+
: never;
|
|
920
|
+
|
|
921
|
+
/** @ignore */
|
|
922
|
+
type RetrievePath<
|
|
923
|
+
R,
|
|
924
|
+
P extends ReadonlyArray<string | number | symbol>
|
|
925
|
+
> = P extends [] ? P : RetrievePathReducer<R, Head<P>, Tail<P>>;
|
|
926
|
+
|
|
837
927
|
interface Map<K, V> extends Collection.Keyed<K, V> {
|
|
838
928
|
/**
|
|
839
929
|
* The number of entries in this Map.
|
|
@@ -1051,16 +1141,17 @@ declare namespace Immutable {
|
|
|
1051
1141
|
*/
|
|
1052
1142
|
merge<KC, VC>(
|
|
1053
1143
|
...collections: Array<Iterable<[KC, VC]>>
|
|
1054
|
-
): Map<K | KC, V | VC>;
|
|
1144
|
+
): Map<K | KC, Exclude<V, VC> | VC>;
|
|
1055
1145
|
merge<C>(
|
|
1056
1146
|
...collections: Array<{ [key: string]: C }>
|
|
1057
|
-
): Map<K | string, V | C>;
|
|
1147
|
+
): Map<K | string, Exclude<V, C> | C>;
|
|
1148
|
+
|
|
1058
1149
|
concat<KC, VC>(
|
|
1059
1150
|
...collections: Array<Iterable<[KC, VC]>>
|
|
1060
|
-
): Map<K | KC, V | VC>;
|
|
1151
|
+
): Map<K | KC, Exclude<V, VC> | VC>;
|
|
1061
1152
|
concat<C>(
|
|
1062
1153
|
...collections: Array<{ [key: string]: C }>
|
|
1063
|
-
): Map<K | string, V | C>;
|
|
1154
|
+
): Map<K | string, Exclude<V, C> | C>;
|
|
1064
1155
|
|
|
1065
1156
|
/**
|
|
1066
1157
|
* Like `merge()`, `mergeWith()` returns a new Map resulting from merging
|
|
@@ -1080,10 +1171,14 @@ declare namespace Immutable {
|
|
|
1080
1171
|
*
|
|
1081
1172
|
* Note: `mergeWith` can be used in `withMutations`.
|
|
1082
1173
|
*/
|
|
1083
|
-
mergeWith(
|
|
1084
|
-
merger: (oldVal: V, newVal:
|
|
1085
|
-
...collections: Array<Iterable<[
|
|
1086
|
-
):
|
|
1174
|
+
mergeWith<KC, VC, VCC>(
|
|
1175
|
+
merger: (oldVal: V, newVal: VC, key: K) => VCC,
|
|
1176
|
+
...collections: Array<Iterable<[KC, VC]>>
|
|
1177
|
+
): Map<K | KC, V | VC | VCC>;
|
|
1178
|
+
mergeWith<C, CC>(
|
|
1179
|
+
merger: (oldVal: V, newVal: C, key: string) => CC,
|
|
1180
|
+
...collections: Array<{ [key: string]: C }>
|
|
1181
|
+
): Map<K | string, V | C | CC>;
|
|
1087
1182
|
|
|
1088
1183
|
/**
|
|
1089
1184
|
* Like `merge()`, but when two compatible collections are encountered with
|
|
@@ -1114,9 +1209,12 @@ declare namespace Immutable {
|
|
|
1114
1209
|
*
|
|
1115
1210
|
* Note: `mergeDeep` can be used in `withMutations`.
|
|
1116
1211
|
*/
|
|
1117
|
-
mergeDeep(
|
|
1118
|
-
...collections: Array<Iterable<[
|
|
1119
|
-
):
|
|
1212
|
+
mergeDeep<KC, VC>(
|
|
1213
|
+
...collections: Array<Iterable<[KC, VC]>>
|
|
1214
|
+
): Map<K | KC, V | VC>;
|
|
1215
|
+
mergeDeep<C>(
|
|
1216
|
+
...collections: Array<{ [key: string]: C }>
|
|
1217
|
+
): Map<K | string, V | C>;
|
|
1120
1218
|
|
|
1121
1219
|
/**
|
|
1122
1220
|
* Like `mergeDeep()`, but when two non-collections or incompatible
|
|
@@ -1584,15 +1682,32 @@ declare namespace Immutable {
|
|
|
1584
1682
|
*/
|
|
1585
1683
|
merge<KC, VC>(
|
|
1586
1684
|
...collections: Array<Iterable<[KC, VC]>>
|
|
1587
|
-
): OrderedMap<K | KC, V | VC>;
|
|
1685
|
+
): OrderedMap<K | KC, Exclude<V, VC> | VC>;
|
|
1588
1686
|
merge<C>(
|
|
1589
1687
|
...collections: Array<{ [key: string]: C }>
|
|
1590
|
-
): OrderedMap<K | string, V | C>;
|
|
1688
|
+
): OrderedMap<K | string, Exclude<V, C> | C>;
|
|
1689
|
+
|
|
1591
1690
|
concat<KC, VC>(
|
|
1592
1691
|
...collections: Array<Iterable<[KC, VC]>>
|
|
1593
|
-
): OrderedMap<K | KC, V | VC>;
|
|
1692
|
+
): OrderedMap<K | KC, Exclude<V, VC> | VC>;
|
|
1594
1693
|
concat<C>(
|
|
1595
1694
|
...collections: Array<{ [key: string]: C }>
|
|
1695
|
+
): OrderedMap<K | string, Exclude<V, C> | C>;
|
|
1696
|
+
|
|
1697
|
+
mergeWith<KC, VC, VCC>(
|
|
1698
|
+
merger: (oldVal: V, newVal: VC, key: K) => VCC,
|
|
1699
|
+
...collections: Array<Iterable<[KC, VC]>>
|
|
1700
|
+
): OrderedMap<K | KC, V | VC | VCC>;
|
|
1701
|
+
mergeWith<C, CC>(
|
|
1702
|
+
merger: (oldVal: V, newVal: C, key: string) => CC,
|
|
1703
|
+
...collections: Array<{ [key: string]: C }>
|
|
1704
|
+
): OrderedMap<K | string, V | C | CC>;
|
|
1705
|
+
|
|
1706
|
+
mergeDeep<KC, VC>(
|
|
1707
|
+
...collections: Array<Iterable<[KC, VC]>>
|
|
1708
|
+
): OrderedMap<K | KC, V | VC>;
|
|
1709
|
+
mergeDeep<C>(
|
|
1710
|
+
...collections: Array<{ [key: string]: C }>
|
|
1596
1711
|
): OrderedMap<K | string, V | C>;
|
|
1597
1712
|
|
|
1598
1713
|
// Sequence algorithms
|
package/dist/immutable.js
CHANGED
|
@@ -5905,64 +5905,7 @@
|
|
|
5905
5905
|
return isIndexed(v) ? v.toList() : isKeyed(v) ? v.toMap() : v.toSet();
|
|
5906
5906
|
}
|
|
5907
5907
|
|
|
5908
|
-
var version = "
|
|
5909
|
-
|
|
5910
|
-
var Immutable = {
|
|
5911
|
-
version: version,
|
|
5912
|
-
|
|
5913
|
-
Collection: Collection,
|
|
5914
|
-
// Note: Iterable is deprecated
|
|
5915
|
-
Iterable: Collection,
|
|
5916
|
-
|
|
5917
|
-
Seq: Seq,
|
|
5918
|
-
Map: Map,
|
|
5919
|
-
OrderedMap: OrderedMap,
|
|
5920
|
-
List: List,
|
|
5921
|
-
Stack: Stack,
|
|
5922
|
-
Set: Set,
|
|
5923
|
-
OrderedSet: OrderedSet,
|
|
5924
|
-
PairSorting: PairSorting,
|
|
5925
|
-
|
|
5926
|
-
Record: Record,
|
|
5927
|
-
Range: Range,
|
|
5928
|
-
Repeat: Repeat,
|
|
5929
|
-
|
|
5930
|
-
is: is,
|
|
5931
|
-
fromJS: fromJS,
|
|
5932
|
-
hash: hash,
|
|
5933
|
-
|
|
5934
|
-
isImmutable: isImmutable,
|
|
5935
|
-
isCollection: isCollection,
|
|
5936
|
-
isKeyed: isKeyed,
|
|
5937
|
-
isIndexed: isIndexed,
|
|
5938
|
-
isAssociative: isAssociative,
|
|
5939
|
-
isOrdered: isOrdered,
|
|
5940
|
-
isValueObject: isValueObject,
|
|
5941
|
-
isPlainObject: isPlainObject,
|
|
5942
|
-
isSeq: isSeq,
|
|
5943
|
-
isList: isList,
|
|
5944
|
-
isMap: isMap,
|
|
5945
|
-
isOrderedMap: isOrderedMap,
|
|
5946
|
-
isStack: isStack,
|
|
5947
|
-
isSet: isSet,
|
|
5948
|
-
isOrderedSet: isOrderedSet,
|
|
5949
|
-
isRecord: isRecord,
|
|
5950
|
-
|
|
5951
|
-
get: get,
|
|
5952
|
-
getIn: getIn$1,
|
|
5953
|
-
has: has,
|
|
5954
|
-
hasIn: hasIn$1,
|
|
5955
|
-
merge: merge,
|
|
5956
|
-
mergeDeep: mergeDeep$1,
|
|
5957
|
-
mergeWith: mergeWith,
|
|
5958
|
-
mergeDeepWith: mergeDeepWith$1,
|
|
5959
|
-
remove: remove,
|
|
5960
|
-
removeIn: removeIn,
|
|
5961
|
-
set: set,
|
|
5962
|
-
setIn: setIn$1,
|
|
5963
|
-
update: update$1,
|
|
5964
|
-
updateIn: updateIn$1,
|
|
5965
|
-
};
|
|
5908
|
+
var version = "5.0.0-beta.1";
|
|
5966
5909
|
|
|
5967
5910
|
// Note: Iterable is deprecated
|
|
5968
5911
|
var Iterable = Collection;
|
|
@@ -5980,7 +5923,6 @@
|
|
|
5980
5923
|
exports.Seq = Seq;
|
|
5981
5924
|
exports.Set = Set;
|
|
5982
5925
|
exports.Stack = Stack;
|
|
5983
|
-
exports.default = Immutable;
|
|
5984
5926
|
exports.fromJS = fromJS;
|
|
5985
5927
|
exports.get = get;
|
|
5986
5928
|
exports.getIn = getIn$1;
|