File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ export function getTogglingfunction ( ) {
2
+ if ( arguments . length == 0 ) {
3
+ function inner ( input ) {
4
+ return ! input ;
5
+ }
6
+ return inner ;
7
+ } else if ( arguments . length != 1 ) {
8
+ var args = arguments ;
9
+ function inner ( input ) {
10
+ let all_arguments = Array . from ( args ) ;
11
+ all_arguments_length = all_arguments . length ;
12
+ index = all_arguments . indexOf ( input ) ;
13
+ return all_arguments [ ( index + 1 ) % all_arguments_length ] ;
14
+ }
15
+ return inner
16
+ } else if ( arguments [ 0 ] instanceof Array ) {
17
+ args = arguments [ 0 ] ;
18
+ function inner ( input ) {
19
+ let all_arguments = args ;
20
+ all_arguments_length = all_arguments . length ;
21
+ index = all_arguments . indexOf ( input ) ;
22
+ return all_arguments [ ( index + 1 ) % all_arguments_length ] ;
23
+ }
24
+ return inner
25
+ } else {
26
+ obj = arguments [ 0 ] ;
27
+ function inner ( input ) {
28
+ inner_obj = obj ;
29
+ return inner_obj [ input ] ;
30
+ }
31
+ return inner
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments