Jump to content

Z10968: Difference between revisions

From Wikifunctions
turn the map into a simpler json, just that I personally it's a simpler implementation and it's advantage would be we can store the data separately from the function in future but if you disagree feel free to just revert my edit
NiferO (talk | contribs)
Translated content to igbo
 
(7 intermediate revisions by 5 users not shown)
Line 10: Line 10:
"Z14K3": {
"Z14K3": {
"Z1K1": "Z16",
"Z1K1": "Z16",
"Z16K1": {
"Z16K1": "Z600",
"Z16K2": "function Z10944( Z10944K1 ) {\n\tconst MORSE_MAP = new Map(Object.entries({\n\t\t\"a\": \".-\",\n\t\t\"b\": \"-...\",\n\t\t\"c\": \"-.-.\",\n\t\t\"d\": \"-..\",\n\t\t\"e\": \".\",\n\t\t\"é\": \"..-..\",\n\t\t\"f\": \"..-.\",\n\t\t\"g\": \"--.\",\n\t\t\"h\": \"....\",\n\t\t\"i\": \"..\",\n\t\t\"j\": \".---\",\n\t\t\"k\": \"-.-\",\n\t\t\"l\": \".-..\",\n\t\t\"m\": \"--\",\n\t\t\"n\": \"-.\",\n\t\t\"o\": \"---\",\n\t\t\"p\": \".--.\",\n\t\t\"q\": \"--.-\",\n\t\t\"r\": \".-.\",\n\t\t\"s\": \"...\",\n\t\t\"t\": \"-\",\n\t\t\"u\": \"..-\",\n\t\t\"v\": \"...-\",\n\t\t\"w\": \".--\",\n\t\t\"x\": \"-..-\",\n\t\t\"y\": \"-.--\",\n\t\t\"z\": \"--..\",\n\t\t\"1\": \".----\",\n\t\t\"2\": \"..---\",\n\t\t\"3\": \"...--\",\n\t\t\"4\": \"....-\",\n\t\t\"5\": \".....\",\n\t\t\"6\": \"-....\",\n\t\t\"7\": \"--...\",\n\t\t\"8\": \"---..\",\n\t\t\"9\": \"----.\",\n\t\t\"0\": \"-----\",\n\t\t\".\": \".-.-.-\",\n\t\t\",\": \"--..--\",\n\t\t\":\": \"---...\",\n\t\t\"?\": \"..--..\",\n\t\t\"'\": \".----.\",\n\t\t\"-\": \"-....-\",\n\t\t\"–\": \"-....-\",\n\t\t\"—\": \"-....-\",\n\t\t\"/\": \"-..-.\",\n\t\t\"(\": \"-.--.\",\n\t\t\")\": \"-.--.-\",\n\t\t\"\\\"\": \".-..-.\",\n\t\t\"“\": \".-..-.\",\n\t\t\"”\": \".-..-.\",\n\t\t\"=\": \"-...-\",\n\t\t\"+\": \".-.-.\",\n\t\t\"×\": \"-..-\",\n\t\t\"@\": \".--.-.\",\n\t\t\" \": \"/\",\n\t}));\n\t\n\tconst inStr = Z10944K1.trim()\n\t\t.toLowerCase()\n\t\t.replace(/\\s+/g, \" \");\n\t\n\treturn [...inStr]\n\t\t.filter(c =\u003E MORSE_MAP.has(c))\n\t\t.map(c =\u003E MORSE_MAP.get(c))\n\t\t.join(\" \");\n}"
"Z1K1": "Z61",
"Z61K1": "javascript"
},
"Z16K2": "function Z10944( Z10944K1 ) {\n\tconst MORSE_MAP = {\n\t\t\"a\": \".-\",\n\t\t\"b\": \"-...\",\n\t\t\"c\": \"-.-.\",\n\t\t\"d\": \"-..\",\n\t\t\"e\": \".\",\n\t\t\"é\": \"..-..\",\n\t\t\"f\": \"..-.\",\n\t\t\"g\": \"--.\",\n\t\t\"h\": \"....\",\n\t\t\"i\": \"..\",\n\t\t\"j\": \".---\",\n\t\t\"k\": \"-.-\",\n\t\t\"l\": \".-..\",\n\t\t\"m\": \"--\",\n\t\t\"n\": \"-.\",\n\t\t\"o\": \"---\",\n\t\t\"p\": \".--.\",\n\t\t\"q\": \"--.-\",\n\t\t\"r\": \".-.\",\n\t\t\"s\": \"...\",\n\t\t\"t\": \"-\",\n\t\t\"u\": \"..-\",\n\t\t\"v\": \"...-\",\n\t\t\"w\": \".--\",\n\t\t\"x\": \"-..-\",\n\t\t\"y\": \"-.--\",\n\t\t\"z\": \"--..\",\n\t\t\"1\": \".----\",\n\t\t\"2\": \"..---\",\n\t\t\"3\": \"...--\",\n\t\t\"4\": \"....-\",\n\t\t\"5\": \".....\",\n\t\t\"6\": \"-....\",\n\t\t\"7\": \"--...\",\n\t\t\"8\": \"---..\",\n\t\t\"9\": \"----.\",\n\t\t\"0\": \"-----\",\n\t\t\".\": \".-.-.-\",\n\t\t\",\": \"--..--\",\n\t\t\":\": \"---...\",\n\t\t\"?\": \"..--..\",\n\t\t\"'\": \".----.\",\n\t\t\"-\": \"-....-\",\n\t\t\"–\": \"-....-\",\n\t\t\"—\": \"-....-\",\n\t\t\"/\": \"-..-.\",\n\t\t\"(\": \"-.--.\",\n\t\t\")\": \"-.--.-\",\n\t\t\"\\\"\": \".-..-.\",\n\t\t\"“\": \".-..-.\",\n\t\t\"”\": \".-..-.\",\n\t\t\"=\": \"-...-\",\n\t\t\"+\": \".-.-.\",\n\t\t\"×\": \"-..-\",\n\t\t\"@\": \".--.-.\",\n\t\t\" \": \"/\",\n\t};\n\t\n\tconst inStr = Z10944K1.trim()\n\t\t.toLowerCase()\n\t\t.replace(/\\s+/g, \" \");\n\t\n\treturn [...inStr]\n\t\t.filter(c =\u003E Object.hasOwn(MORSE_MAP, c))\n\t\t.map(c =\u003E MORSE_MAP[c])\n\t\t.join(\" \");\n}"
}
}
},
},
Line 25: Line 22:
"Z11K1": "Z1002",
"Z11K1": "Z1002",
"Z11K2": " international morse code encode in JavaScript"
"Z11K2": " international morse code encode in JavaScript"
},
{
"Z1K1": "Z11",
"Z11K1": "Z1430",
"Z11K2": "Internationaler Morsecode enkodieren in JavaScript"
},
{
"Z1K1": "Z11",
"Z11K1": "Z1531",
"Z11K2": " mengekod kod morse antarabangsa dalam JavaScript"
},
{
"Z1K1": "Z11",
"Z11K1": "Z1434",
"Z11K2": "مڠکود کود مورس انتارابڠسا دالم جاۏاسکريڤ"
},
{
"Z1K1": "Z11",
"Z11K1": "Z1014",
"Z11K2": "Koodu morse mba ụwa na Javascript"
}
}
]
]
Line 37: Line 54:
"Z1K1": "Z12",
"Z1K1": "Z12",
"Z12K1": [
"Z12K1": [
"Z11"
"Z11",
{
"Z1K1": "Z11",
"Z11K1": "Z1430",
"Z11K2": "wandelt einen Text in Internationalen Morsecode um, Implementierung in JavaScript"
},
{
"Z1K1": "Z11",
"Z11K1": "Z1014",
"Z11K2": "na-atụgharị ederede ka ọ bụrụ Koodu morse mba ụwa , mmejuputa na Javascript"
}
]
]
}
}

Latest revision as of 21:26, 2 July 2024

This page displays in a limited way without JavaScript.