More error handling stuff
This commit is contained in:
@ -11,7 +11,8 @@ module.exports = {
|
||||
name: "Shift",
|
||||
type: "number",
|
||||
required: true,
|
||||
inline: true
|
||||
inline: true,
|
||||
default: "0"
|
||||
}
|
||||
},
|
||||
output: true,
|
||||
|
@ -25,7 +25,7 @@ module.exports = {
|
||||
.filter((pair)=>(pair.length == 2))
|
||||
.map((pair)=>(parseInt(pair, 16)))
|
||||
.map((int)=>(String.fromCharCode(int)))
|
||||
.join("")
|
||||
.join("");
|
||||
},
|
||||
pageBlock: {
|
||||
html: "",
|
||||
|
@ -10,19 +10,13 @@ module.exports = {
|
||||
offset: {
|
||||
name: "Offset",
|
||||
type: "text",
|
||||
required: true,
|
||||
inline: false
|
||||
required: false,
|
||||
inline: false,
|
||||
default: "0"
|
||||
}
|
||||
},
|
||||
output: true,
|
||||
execute: function({letters, offset}, elem){
|
||||
if(!offset){
|
||||
offset = 0;
|
||||
}
|
||||
else{
|
||||
offset = parseInt(offset);
|
||||
}
|
||||
|
||||
return letters
|
||||
.split("")
|
||||
.map((char)=>(char.charCodeAt(0)))
|
||||
@ -35,7 +29,7 @@ module.exports = {
|
||||
return asciiVal - 97;
|
||||
}
|
||||
})
|
||||
.map((num)=>(num + offset))
|
||||
.map((num)=>(num + parseInt(offset)))
|
||||
.map((num)=>(((num%26)+26)%26))
|
||||
.join(",");
|
||||
},
|
||||
|
@ -10,34 +10,20 @@ module.exports = {
|
||||
offset: {
|
||||
name: "Offset",
|
||||
type: "text",
|
||||
required: true,
|
||||
inline: false
|
||||
required: false,
|
||||
inline: false,
|
||||
default: "0"
|
||||
}
|
||||
},
|
||||
output: true,
|
||||
execute: function({nums, offset}, elem){
|
||||
if(!offset){
|
||||
offset = 0;
|
||||
}
|
||||
else{
|
||||
offset = parseInt(offset);
|
||||
}
|
||||
|
||||
return nums
|
||||
.split(",")
|
||||
.filter((num)=>(num))
|
||||
.map((num)=>(parseInt(num)))
|
||||
.filter((num)=>(!isNaN(num)))
|
||||
.map((num)=>(num - offset))
|
||||
.map((num)=>(num%52))
|
||||
.map((num)=>{
|
||||
if(num < 0){
|
||||
return 52 + num;
|
||||
}
|
||||
else{
|
||||
return num;
|
||||
}
|
||||
})
|
||||
.map((num)=>(num - parseInt(offset)))
|
||||
.map((num)=>((num%52)+52)%52)
|
||||
.map((num)=>{
|
||||
if(num < 26){
|
||||
asciiOffset = 97;
|
||||
|
Reference in New Issue
Block a user