Som more signatures for magic

This commit is contained in:
n1073645 2019-12-05 10:16:40 +00:00
parent 6d3ed149d8
commit 50d16ca3d2
2 changed files with 30 additions and 0 deletions

View file

@ -8,6 +8,7 @@ import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs"; import OperationError from "../errors/OperationError.mjs";
import Utils from "../Utils.mjs"; import Utils from "../Utils.mjs";
import {alphabetName, ALPHABET_OPTIONS} from "../lib/Base85.mjs"; import {alphabetName, ALPHABET_OPTIONS} from "../lib/Base85.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* From Base85 operation * From Base85 operation
@ -33,6 +34,26 @@ class FromBase85 extends Operation {
value: ALPHABET_OPTIONS value: ALPHABET_OPTIONS
}, },
]; ];
this.checks = new magicObject([
{
match: "^\\s*(<~)?([!-u]{4})+([!-u]{1,3})??(~>)?\\s*$",
flags: "",
magic: false,
args: ["!-u", true]
},
{
match: "^\\s*(<~)?([0-9A-Z.-:+=^!/*?&<>()[]{}@%$#]{4})+([0-9A-Z.-:+=^!/*?&<>()[]{}@%$#]{1,3})??(~>)?\\s*$",
flags: "i",
magic: false,
args: ["0-9a-zA-Z.-:+=^!/*?&<>()[]{}@%$#", true]
},
{
match: "^\\s*(<~)?([0-9A-Z.-:+=^!/*?&_<>()[]{}@%$#;`|~]{4})+([0-9A-Z.-:+=^!/*?&_<>()[]{}@%$#;`|~]{1,3})??(~>)?\\s*$",
flags: "i",
magic: false,
args: ["0-9A-Za-z!#$%&()*+-;<=>?@^_`{|~}", true]
}
]);
} }
/** /**

View file

@ -6,6 +6,7 @@
import Operation from "../Operation.mjs"; import Operation from "../Operation.mjs";
import {BRAILLE_LOOKUP} from "../lib/Braille.mjs"; import {BRAILLE_LOOKUP} from "../lib/Braille.mjs";
import magicObject from "../lib/MagicObject.mjs";
/** /**
* From Braille operation * From Braille operation
@ -25,6 +26,14 @@ class FromBraille extends Operation {
this.inputType = "string"; this.inputType = "string";
this.outputType = "string"; this.outputType = "string";
this.args = []; this.args = [];
this.checks = new magicObject([
{
match: "^\\s*[⠀⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿]+\\s*$",
flags: "i",
magic: true,
args: [true]
}
]);
} }
/** /**