8000 Deploy 59c291a2b37693198a0950637c5d55cd14dd6bc4 to NPM branch · rplansky/immutable-js@d495baa · GitHub
[go: up one dir, main page]

Skip to content

Commit d495baa

Browse files
author
Travis CI
committed
Deploy 59c291a to NPM branch
1 parent cc11155 commit d495baa

File tree

6 files changed

+295
-168
lines changed

6 files changed

+295
-168
lines changed

dist/immutable-nonambient.d.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2674,7 +2674,7 @@
26742674
* True if `maybeSeq` is a Seq, it is not backed by a concrete
26752675
* structure such as Map, List, or Set.
26762676
*/
2677-
function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed<any> | Seq.Keyed<any, any>;
2677+
function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed<any> | Seq.Keyed<any, any> | Seq.Set<any>;
26782678

26792679

26802680
/**
@@ -4991,6 +4991,53 @@
49914991
*/
49924992
export function isValueObject(maybeValue: any): maybeValue is ValueObject;
49934993

4994+
4995+
/**
4996+
* True if `maybeSeq` is a Seq.
4997+
*/
4998+
export function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed<any> | Seq.Keyed<any, any> | Seq.Set<any>;
4999+
5000+
/**
5001+
* True if `maybeList` is a List.
5002+
*/
5003+
export function isList(maybeList: any): maybeList is List<any>;
5004+
5005+
/**
5006+
* True if `maybeMap` is a Map.
5007+
*
5008+
* Also true for OrderedMaps.
5009+
*/
5010+
export function isMap(maybeMap: any): maybeMap is Map<any, any>;
5011+
5012+
/**
5013+
* True if `maybeOrderedMap` is an OrderedMap.
5014+
*/
5015+
export function isOrderedMap(maybeOrderedMap: any): maybeOrderedMap is OrderedMap<any, any>;
5016+
5017+
/**
5018+
* True if `maybeStack` is a Stack.
5019+
*/
5020+
export function isStack(maybeStack: any): maybeStack is Stack<any>;
5021+
5022+
/**
5023+
* True if `maybeSet` is a Set.
5024+
*
5025+
* Also true for OrderedSets.
5026+
*/
5027+
export function isSet(maybeSet: any): maybeSet is Set<any>;
5028+
5029+
/**
5030+
* True if `maybeOrderedSet` is an OrderedSet.
5031+
*/
5032+
export function isOrderedSet(maybeOrderedSet: any): maybeOrderedSet is OrderedSet<any>;
5033+
5034+
/**
5035+
* True if `maybeRecord` is a Record.
5036+
*/
5037+
export function isRecord(maybeRecord: any): maybeRecord is Record<any>;
5038+
5039+
5040+
49945041
/**
49955042
* Returns the value within the provided collection associated with the
49965043
* provided key, or notSetValue if the key is not defined in the collection.

dist/immutable.d.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2674,7 +2674,7 @@ declare module Immutable {
26742674
* True if `maybeSeq` is a Seq, it is not backed by a concrete
26752675
* structure such as Map, List, or Set.
26762676
*/
2677-
function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed<any> | Seq.Keyed<any, any>;
2677+
function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed<any> | Seq.Keyed<any, any> | Seq.Set<any>;
26782678

26792679

26802680
/**
@@ -4991,6 +4991,53 @@ declare module Immutable {
49914991
*/
49924992
export function isValueObject(maybeValue: any): maybeValue is ValueObject;
49934993

4994+
4995+
/**
4996+
* True if `maybeSeq` is a Seq.
4997+
*/
4998+
export function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed<any> | Seq.Keyed<any, any> | Seq.Set<any>;
4999+
5000+
/**
5001+
* True if `maybeList` is a List.
5002+
*/
5003+
export function isList(maybeList: any): maybeList is List<any>;
5004+
5005+
/**
5006+
* True if `maybeMap` is a Map.
5007+
*
5008+
* Also true for OrderedMaps.
5009+
*/
5010+
export function isMap(maybeMap: any): maybeMap is Map<any, any>;
5011+
5012+
/**
5013+
* True if `maybeOrderedMap` is an OrderedMap.
5014+
*/
5015+
export function isOrderedMap(maybeOrderedMap: any): maybeOrderedMap is OrderedMap<any, any>;
5016+
5017+
/**
5018+
* True if `maybeStack` is a Stack.
5019+
*/
5020+
export function isStack(maybeStack: any): maybeStack is Stack<any>;
5021+
5022+
/**
5023+
* True if `maybeSet` is a Set.
5024+
*
5025+
* Also true for OrderedSets.
5026+
*/
5027+
export function isSet(maybeSet: any): maybeSet is Set<any>;
5028+
5029+
/**
5030+
* True if `maybeOrderedSet` is an OrderedSet.
5031+
*/
5032+
export function isOrderedSet(maybeOrderedSet: any): maybeOrderedSet is OrderedSet<any>;
5033+
5034+
/**
5035+
* True if `maybeRecord` is a Record.
5036+
*/
5037+
export function isRecord(maybeRecord: any): maybeRecord is Record<any>;
5038+
5039+
5040+
49945041
/**
49955042
* Returns the value within the provided collection associated with the
49965043
* provided key, or notSetValue if the key is not defined in the collection.

dist/immutable.es.js

Lines changed: 79 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -97,49 +97,29 @@ function isNeg(value) {
9797
return value < 0 || (value === 0 && 1 / value === -Infinity);
9898
}
9999

100-
function isImmutable(maybeImmutable) {
101-
return isCollection(maybeImmutable) || isRecord(maybeImmutable);
102-
}
100+
// Note: value is unchanged to not break immutable-devtools.
101+
var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
103102

104103
function isCollection(maybeCollection) {
105-
return !!(maybeCollection && maybeCollection[IS_COLLECTION_SYMBOL]);
104+
return Boolean(maybeCollection && maybeCollection[IS_COLLECTION_SYMBOL]);
106105
}
107106

107+
var IS_KEYED_SYMBOL = '@@__IMMUTABLE_KEYED__@@';
108+
108109
function isKeyed(maybeKeyed) {
109-
return !!(maybeKeyed && maybeKeyed[IS_KEYED_SYMBOL]);
110+
return Boolean(maybeKeyed && maybeKeyed[IS_KEYED_SYMBOL]);
110111
}
111112

113+
var IS_INDEXED_SYMBOL = '@@__IMMUTABLE_INDEXED__@@';
114+
112115
function isIndexed(maybeIndexed) {
113-
return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SYMBOL]);
116+
return Boolean(maybeIndexed && maybeIndexed[IS_INDEXED_SYMBOL]);
114117
}
115118

116119
function isAssociative(maybeAssociative) {
117120
return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);
118121
}
119122

120-
function isOrdered(maybeOrdered) {
121-
return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SYMBOL]);
122-
}
123-
124-
function isRecord(maybeRecord) {
125-
return !!(maybeRecord && maybeRecord[IS_RECORD_SYMBOL]);
126-
}
127-
128-
function isValueObject(maybeValue) {
129-
return !!(
130-
maybeValue &&
131-
typeof maybeValue.equals === 'function' &&
132-
typeof maybeValue.hashCode === 'function'
133-
);
134-
}
135-
136-
// Note: values unchanged to preserve immutable-devtools.
137-
var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
138-
var IS_KEYED_SYMBOL = '@@__IMMUTABLE_KEYED__@@';
139-
var IS_INDEXED_SYMBOL = '@@__IMMUTABLE_INDEXED__@@';
140-
var IS_ORDERED_SYMBOL = '@@__IMMUTABLE_ORDERED__@@';
141-
var IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@';
142-
143123
var Collection = function Collection(value) {
144124
return isCollection(value) ? value : Seq(value);
145125
};
@@ -184,6 +164,28 @@ Collection.Keyed = KeyedCollection;
184164
Collection.Indexed = IndexedCollection;
185165
Collection.Set 2851 = SetCollection;
186166

167+
var IS_SEQ_SYMBOL = '@@__IMMUTABLE_SEQ__@@';
168+
169+
function isSeq(maybeSeq) {
170+
return Boolean(maybeSeq && maybeSeq[IS_SEQ_SYMBOL]);
171+
}
172+
173+
var IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@';
174+
175+
function isRecord(maybeRecord) {
176+
return Boolean(maybeRecord && maybeRecord[IS_RECORD_SYMBOL]);
177+
}
178+
179+
function isImmutable(maybeImmutable) {
180+
return isCollection(maybeImmutable) || isRecord(maybeImmutable);
181+
}
182+
183+
var IS_ORDERED_SYMBOL = '@@__IMMUTABLE_ORDERED__@@';
184+
185+
function isOrdered(maybeOrdered) {
186+
return Boolean(maybeOrdered && maybeOrdered[IS_ORDERED_SYMBOL]);
187+
}
188+
187189
var ITERATE_KEYS = 0;
188190
var ITERATE_VALUES = 1;
189191
var ITERATE_ENTRIES = 2;
@@ -425,8 +427,6 @@ Seq.Keyed = KeyedSeq;
425427
Seq.Set = SetSeq;
426428
Seq.Indexed = IndexedSeq;
427429

428-
var IS_SEQ_SYMBOL = '@@__IMMUTABLE_SEQ__@@';
429-
430430
Seq.prototype[IS_SEQ_SYMBOL] = true;
431431

432432
// #pragma Root Sequences
@@ -584,10 +584,6 @@ var CollectionSeq = (function (IndexedSeq) {
584584

585585
// # pragma Helper functions
586586

587-
function isSeq(maybeSeq) {
588-
return !!(maybeSeq && maybeSeq[IS_SEQ_SYMBOL]);
589-
}
590-
591587
var EMPTY_SEQ;
592588

593589
function emptySequence() {
@@ -643,6 +639,24 @@ function maybeIndexedSeqFromValue(value) {
643639
: undefined;
644640
}
645641

642+
var IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';
643+
644+
function isMap(maybeMap) {
645+
return Boolean(maybeMap && maybeMap[IS_MAP_SYMBOL]);
646+
}
647+
648+
function isOrderedMap(maybeOrderedMap) {
649+
return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
650+
}
651+
652+
function isValueObject(maybeValue) {
653+
return Boolean(
654+
maybeValue &&
655+
typeof maybeValue.equals === 'function' &&
656+
typeof maybeValue.hashCode === 'function'
657+
);
658+
}
659+
646660
/**
647661
* An extension of the "same-value" algorithm as [described for use by ES6 Map
648662
* and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)
@@ -2382,14 +2396,8 @@ var Map = (function (KeyedCollection$$1) {
23822396
return Map;
23832397
}(KeyedCollection));
23842398

2385-
function isMap(maybeMap) {
2386-
return !!(maybeMap && maybeMap[IS_MAP_SYMBOL]);
2387-
}
2388-
23892399
Map.isMap = isMap;
23902400

2391-
var IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';
2392-
23932401
var MapPrototype = Map.prototype;
23942402
MapPrototype[IS_MAP_SYMBOL] = true;
23952403
MapPrototype[DELETE] = MapPrototype.remove;
@@ -3041,6 +3049,12 @@ var MAX_ARRAY_MAP_SIZE = SIZE / 4;
30413049
var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;
30423050
var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;
30433051

3052+
var IS_LIST_SYMBOL = '@@__IMMUTABLE_LIST__@@';
3053+
3054+
function isList(maybeList) {
3055+
return Boolean(maybeList && maybeList[IS_LIST_SYMBOL]);
3056+
}
3057+
30443058
var List = (function (IndexedCollection$$1) {
30453059
function List(value) {
30463060
var empty = emptyList();
@@ -3260,14 +3274,8 @@ var List = (function (IndexedCollection$$1) {
32603274
return List;
32613275
}(IndexedCollection));
32623276

3263-
function isList(maybeList) {
3264-
return !!(maybeList && maybeList[IS_LIST_SYMBOL]);
3265-
}
3266-
32673277
List.isList = isList;
32683278

3269-
var IS_LIST_SYMBOL = '@@__IMMUTABLE_LIST__@@';
3270-
32713279
var ListPrototype = List.prototype;
32723280
ListPrototype[IS_LIST_SYMBOL] = true;
32733281
ListPrototype[DELETE] = ListPrototype.remove;
@@ -3794,10 +3802,6 @@ var OrderedMap = (function (Map$$1) {
37943802
return OrderedMap;
37953803
}(Map));
37963804

3797-
function isOrderedMap(maybeOrderedMap) {
3798-
return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
3799-
}
3800-
38013805
OrderedMap.isOrderedMap = isOrderedMap;
38023806

38033807
OrderedMap.prototype[IS_ORDERED_SYMBOL] = true;
@@ -3867,6 +3871,12 @@ function updateOrderedMap(omap, k, v) {
38673871
return makeOrderedMap(newMap, newList);
38683872
}
38693873

3874+
var IS_STACK_SYMBOL = '@@__IMMUTABLE_STACK__@@';
3875+
3876+
function isStack(maybeStack) {
3877+
return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);
3878+
}
3879+
38703880
var Stack = (function (IndexedCollection$$1) {
38713881
function Stack(value) {
38723882
return value === null || value === undefined
@@ -4058,14 +4068,8 @@ var Stack = (function (IndexedCollection$$1) {
40584068
return Stack;
40594069
}(IndexedCollection));
40604070

4061-
function isStack(maybeStack) {
4062-
return !!(maybeStack && maybeStack[IS_STACK_SYMBOL]);
4063-
}
4064-
40654071
Stack.isStack = isStack;
40664072

4067-
var IS_STACK_SYMBOL = '@@__IMMUTABLE_STACK__@@';
4068-
40694073
var StackPrototype = Stack.prototype;
40704074
StackPrototype[IS_STACK_SYMBOL] = true;
40714075
StackPrototype.shift = StackPrototype.pop;
@@ -4097,6 +4101,16 @@ function emptyStack() {
40974101
return EMPTY_STACK || (EMPTY_STACK = makeStack(0));
40984102
}
40994103

4104+
var IS_SET_SYMBOL = '@@__IMMUTABLE_SET__@@';
4105+
4106+
function isSet(maybeSet) {
4107+
return Boolean(maybeSet && maybeSet[IS_SET_SYMBOL]);
4108+
}
4109+
4110+
function isOrderedSet(maybeOrderedSet) {
4111+
return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
4112+
}
4113+
41004114
function deepEqual(a, b) {
41014115
if (a === b) {
41024116
return true;
@@ -4374,14 +4388,8 @@ var Set = (function (SetCollection$$1) {
43744388
return Set;
43754389
}(SetCollection));
43764390

4377-
function isSet(maybeSet) {
4378-
return !!(maybeSet && maybeSet[IS_SET_SYMBOL]);
4379-
}
4380-
43814391
Set.isSet = isSet;
43824392

4383-
var IS_SET_SYMBOL = '@@__IMMUTABLE_SET__@@';
4384-
43854393
var SetPrototype = Set.prototype;
43864394
SetPrototype[IS_SET_SYMBOL] = true;
43874395
SetPrototype[DELETE] = SetPrototype.remove;
@@ -5355,10 +5363,6 @@ var OrderedSet = (function (Set$$1) {
53555363
return OrderedSet;
53565364
}(Set));
53575365

5358-
function isOrderedSet(maybeOrderedSet) {
5359-
return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
5360-
}
5361-
53625366
OrderedSet.isOrderedSet = isOrderedSet;
53635367

53645368
var OrderedSetPrototype = OrderedSet.prototype;
@@ -5775,6 +5779,14 @@ var Immutable = {
57755779
isAssociative: isAssociative,
57765780
isOrdered: isOrdered,
57775781
isValueObject: isValueObject,
5782+
isSeq: isSeq,
5783+
isList: isList,
5784+
isMap: isMap,
5785+
isOrderedMap: isOrderedMap,
5786+
isStack: isStack,
5787+
isSet: isSet,
5788+
isOrderedSet: isOrderedSet,
5789+
isRecord: isRecord,
57785790

57795791
get: get,
57805792
getIn: getIn,

0 commit comments

Comments
 (0)
0