Skip to content

Commit 8139d42

Browse files
committed
hasIn is to has as getIn is to get.
closes immutable-js#247
1 parent efca90e commit 8139d42

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

dist/immutable.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,12 @@ declare module 'immutable' {
13461346
getIn(searchKeyPath: Array<any>, notSetValue?: any): any;
13471347
getIn(searchKeyPath: Iterable<any, any>, notSetValue?: any): any;
13481348

1349+
/**
1350+
* True if the result of following a path of keys or indices through nested
1351+
* Iterables results in a set value.
1352+
*/
1353+
hasIn(searchKeyPath): boolean;
1354+
13491355

13501356
// Conversion to JavaScript types
13511357

dist/immutable.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,9 @@ var $Iterable = Iterable;
532532
has: function(searchKey) {
533533
return this.get(searchKey, NOT_SET) !== NOT_SET;
534534
},
535+
hasIn: function(searchKeyPath) {
536+
return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET;
537+
},
535538
isSubset: function(iter) {
536539
iter = typeof iter.contains === 'function' ? iter : $Iterable(iter);
537540
return this.every((function(value) {

0 commit comments

Comments
 (0)