ascii-name
v2.0.0
Published
Return name(s) of ASCII code characters in multiple languages.
Readme
ascii-name
Return name(s) of ASCII code characters in multiple languages.
Install
$ npm install ascii-nameUsage
// For ESM (Modern Node.js / Vite / Next.js etc.)
import asciiName from 'ascii-name';
// For CommonJS (Legacy Node.js)
const asciiName = require('ascii-name');
// String is supported
asciiName.getName(':'); // returns 'colon'
// ASCII decimal value is supported
asciiName.getName(58); // returns 'colon'
// Multiple names supported (if available in JSON)
asciiName.getName('#'); // returns 'number sign' (default index 0)
asciiName.getName('#', 0); // returns 'number sign'
asciiName.getName('#', 1); // returns 'pound' (see ascii-name_en.json)
// Multi-language support
asciiName.setLanguage('ko'); // set language code (Korean)
asciiName.getLanguage(); // returns 'ko' (Default: 'en')
asciiName.getName(':'); // returns '콜론' from ascii-name_ko.json
asciiName.getName(0); // returns 'null' from ascii-name_en.json (fallback to default language if not in current)Supported Languages
- en: English
- de: German
- es: Spanish
- fr: French
- it: Italian
- pt: Portuguese
- ru: Russian
- hi: Hindi
- ar: Arabic
- ko: Korean
- ja: Japanese
- zh: Chinese
Contributing
Feel free to contribute by adding more languages or reporting issues! Make a Pull Request at ascii-name if needed.
License
MIT License © Heeseong Yoo
