summaryrefslogtreecommitdiff
path: root/pieces/kbutils.js
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2024-04-10 03:41:05 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2024-04-10 03:41:05 +0300
commit0c65dee04506567ee50537ff2fbb83998b8fef0f (patch)
treeddeeaf79671b81254dc8960006adfb58016dfc25 /pieces/kbutils.js
parented92bae9b662beba81889a62e29828302503fe8f (diff)
downloadoseine-0c65dee04506567ee50537ff2fbb83998b8fef0f.tar.gz
oseine-0c65dee04506567ee50537ff2fbb83998b8fef0f.tar.bz2
oseine-0c65dee04506567ee50537ff2fbb83998b8fef0f.zip
add methods in kb-util module; intoduce match-util module
Diffstat (limited to 'pieces/kbutils.js')
-rw-r--r--pieces/kbutils.js29
1 files changed, 0 insertions, 29 deletions
diff --git a/pieces/kbutils.js b/pieces/kbutils.js
deleted file mode 100644
index bef37d4..0000000
--- a/pieces/kbutils.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/** keyboardize
- * -------------------------------------------------------------------------
- * translates string to keyboard-latin keys
- * (the ones that used whan typing each letter of the word)
- *
- * @param str (string): original string (utf8 of latin or greek subgroups)
- * @return (string): latin/ascii equivalent string
- */
-
-ORiGiNal = 'ςερτυθιοπασδφγηξκλζχψωβνμΕΡΤΥΘΙΟΠΑΣΔΦΓΗΞΚΛΖΧΨΩΒΝΜάέήίόύώϊΐϋΆΈΉΊΌΎΏΪΫQWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm0123456789- '.split('');
-
-kbKeyZed = 'sertyuiopasdfghjklzxcvbnmertyuiopasdfghjklzxcvbnmaehioyviiyaehioyviyqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm0123456789- '.split('');
-
-map = new Map();
-for (var i=0; i<ORiGiNal.length; i++) map.set(ORiGiNal[i], kbKeyZed[i]);
-
-exports.keybutil = {
-
- map: map,
-
- keyboardize: function(str) {
- str = str.replace('\'','');
- var out = '';
- // [map]'s implementation is 40x faster than [for]'s
- for (var i=0 ; i< str.length; i++) out += map.get(str[i]);
- return out;
- }
-
-}; \ No newline at end of file