blob: 4ad89b03c66d7a93faf1497445b35e980db68546 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// A set of combine utilities for use with Space.comb()
// Note: char1 is this and char2 is other. char1 will go "over" char2
exports.add = function(char1, char2){
if (char1 == '') return char2;
else return char1;
}
exports.sub = function(char1, char2){
if (char1 == char2) return '';
else return char1;
}
exports.mask = function(char1, char2){ // Meant for hiding text (if char1 is valid, mask char2 with null character)
if (char1 == '') return char2;
else return '';
}
exports.unmask = function(char1, char2){ // Opposite of .mask: shows char2 only if char1 is valid
if (char1 == '') return '';
else return char2;
}
exports.flip = function(func){ // Switches this and other in the combination algorithm
return (char2, char1) => func(char1, char2);
}
|