From 50d16ca3d2cc379b285762bc8943e012f9029028 Mon Sep 17 00:00:00 2001 From: n1073645 Date: Thu, 5 Dec 2019 10:16:40 +0000 Subject: [PATCH] Som more signatures for magic --- src/core/operations/FromBase85.mjs | 21 +++++++++++++++++++++ src/core/operations/FromBraille.mjs | 9 +++++++++ 2 files changed, 30 insertions(+) diff --git a/src/core/operations/FromBase85.mjs b/src/core/operations/FromBase85.mjs index c874d5dc..1f40a8e5 100644 --- a/src/core/operations/FromBase85.mjs +++ b/src/core/operations/FromBase85.mjs @@ -8,6 +8,7 @@ import Operation from "../Operation.mjs"; import OperationError from "../errors/OperationError.mjs"; import Utils from "../Utils.mjs"; import {alphabetName, ALPHABET_OPTIONS} from "../lib/Base85.mjs"; +import magicObject from "../lib/MagicObject.mjs"; /** * From Base85 operation @@ -33,6 +34,26 @@ class FromBase85 extends Operation { 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] + } + ]); } /** diff --git a/src/core/operations/FromBraille.mjs b/src/core/operations/FromBraille.mjs index adbcff91..1318831b 100644 --- a/src/core/operations/FromBraille.mjs +++ b/src/core/operations/FromBraille.mjs @@ -6,6 +6,7 @@ import Operation from "../Operation.mjs"; import {BRAILLE_LOOKUP} from "../lib/Braille.mjs"; +import magicObject from "../lib/MagicObject.mjs"; /** * From Braille operation @@ -25,6 +26,14 @@ class FromBraille extends Operation { this.inputType = "string"; this.outputType = "string"; this.args = []; + this.checks = new magicObject([ + { + match: "^\\s*[⠀⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿]+\\s*$", + flags: "i", + magic: true, + args: [true] + } + ]); } /**