Skip to content

Commit fc3d6a0

Browse files
transition function implemented jashkenas#2850
1 parent 311b04e commit fc3d6a0

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

modules/_transition.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
}

0 commit comments

Comments
 (0)