File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ var isMap = require ( 'is-map' ) ;
4
+ var isSet = require ( 'is-set' ) ;
5
+ var isWeakMap = require ( 'is-weakmap' ) ;
6
+ var isWeakSet = require ( 'is-weakset' ) ;
7
+
8
+ module . exports = function whichCollection ( value ) {
9
+ if ( value && typeof value === 'object' ) {
10
+ if ( isMap ( value ) ) {
11
+ return 'Map' ;
12
+ }
13
+ if ( isSet ( value ) ) {
14
+ return 'Set' ;
15
+ }
16
+ if ( isWeakMap ( value ) ) {
17
+ return 'WeakMap' ;
18
+ }
19
+ if ( isWeakSet ( value ) ) {
20
+ return 'WeakSet' ;
21
+ }
22
+ }
23
+ return false ;
24
+ } ;
Original file line number Diff line number Diff line change 37
37
"for-each" : " ^0.3.3" ,
38
38
"object-inspect" : " ^1.7.0" ,
39
39
"tape" : " ^4.11.0"
40
+ },
41
+ "dependencies" : {
42
+ "is-map" : " ^2.0.0" ,
43
+ "is-set" : " ^2.0.0" ,
44
+ "is-weakmap" : " ^2.0.0" ,
45
+ "is-weakset" : " ^2.0.0"
40
46
}
41
47
}
You can’t perform that action at this time.
0 commit comments