smallcapper-cli
Version:
The CLI version of smallcaps-js.
23 lines (21 loc) • 951 B
JavaScript
const args = process.argv
const match = { a: 'ᴀ', b: 'ʙ', c: 'ᴄ', d: 'ᴅ', e: 'ᴇ', f: 'ꜰ', g: 'ɢ', h: 'ʜ', i: 'ɪ', j: 'ᴊ', k: 'ᴋ', l: 'ʟ', m: 'ᴍ', n: 'ɴ', o: 'ᴏ', p: 'ᴘ', q: 'ǫ', r: 'ʀ', s: 'ꜱ', t: 'ᴛ', u: 'ᴜ', v: 'ᴠ', w: 'ᴡ', x: 'x', y: 'ʏ', z: 'ᴢ' }
if (args.length == 3 && args[2] == "help" || args.length == 2) {
console.log("\nUsage: smallcaps-cli help")
console.log(" smallcaps-cli <input>'")
console.log("\nThe input supports spaces.")
} else {
var final = ''
args.forEach(function (val, index, array) {
if (index != 0 && index != 1) {
if (index != 2) {
final = final + ` ${val}`
} else {
final = final + `${val}`
}
}
})
final = final.toLowerCase().split('').map((l, i) => (match[l] !== undefined) ? match[l] : l).join('');
console.log(final)
};