npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

unicode-text-decorator

v0.1.1

Published

[![Node.js CI](https://github.com/ryo-a/unicode-text-decorator/actions/workflows/node.js.yml/badge.svg?branch=main)](https://github.com/ryo-a/unicode-text-decorator/actions/workflows/node.js.yml)

Downloads

248

Readme

unicode-text-decorator

Node.js CI

unicode-text-decorator is a simple library to convert ASCII text to decorated text.

𝚞𝚗𝚒𝚌𝚘𝚍𝚎-𝚝𝚎𝚡𝚝-𝚍𝚎𝚌𝚘𝚛𝚊𝚝𝚘𝚛 is 𝗮 𝘀𝗶𝗺𝗽𝗹𝗲 𝗹𝗶𝗯𝗿𝗮𝗿𝘆 to 𝕔𝕠𝕟𝕧𝕖𝕣𝕥 ⒶⓈⒸⒾⒾ text to 🇩🇪🇨🇴🇷🇦🇹🇪🇩 text.

Notice

These Unicode characters are basically symbols provided for expressing mathematical formulae and so on. Hence they are not recongnised as Latin alphabet characters and have accessibility problems like text-to-speech. Not only this library but also these "decorated Unicode fonts" are just for hobby and playing use.

Install

npm i unicode-text-decorator

Usage

utd.decorate(targetText, fontName)

const utd = require('unicode-text-decorator');

let wildScreen = utd.decorate('wi(l)d-screen', 'bold_italic_serif');
let baroque = utd.decorate('baroque', 'bold_sans_serif');

console.log(wildScreen + ' ' + baroque);

let nanaDaiba = utd.decorate('Nana Daiba / 大場なな (CV: Moeka Koizumi / 小泉萌香)', 'bold_script');
console.log(nanaDaiba);

expected output

𝒘𝒊(𝒍)𝒅-𝒔𝒄𝒓𝒆𝒆𝒏 𝗯𝗮𝗿𝗼𝗾𝘂𝗲
𝓝𝓪𝓷𝓪 𝓓𝓪𝓲𝓫𝓪 / 大場なな (𝓒𝓥: 𝓜𝓸𝓮𝓴𝓪 𝓚𝓸𝓲𝔃𝓾𝓶𝓲 / 小泉萌香)

Symbols (like space and /) and non-ASCII characters are ignored.

FYI: wi(l)d-screen baroque is the song appeard in the movie of Revue Starlight. The title of the song is displayed in a mixture of serif and sans-serif in the scene.

Supported Font

| font name | Example | Capital Letters | Small Letters | Numbers | | :--------------------- | :------------- | :-------------- | :------------ | :------ | | bold_serif | 𝐔𝐧𝐢𝐜𝐨𝐝𝐞 | ✅ | ✅ | ✅ | | italic_serif | 𝑈𝑛𝑖𝑐𝑜𝑑𝑒 | ✅ | ✅ | | | bold_italic_serif | 𝑼𝒏𝒊𝒄𝒐𝒅𝒆 | ✅ | ✅ | | | script | 𝒰𝓃𝒾𝒸ℴ𝒹ℯ | ✅ | ✅ | | | bold_script | 𝓤𝓷𝓲𝓬𝓸𝓭𝓮 | ✅ | ✅ | | | fraktur | 𝔘𝔫𝔦𝔠𝔬𝔡𝔢 | ✅ | ✅ | | | bold_fraktur | 𝖀𝖓𝖎𝖈𝖔𝖉𝖊 | ✅ | ✅ | | | double_struck | 𝕌𝕟𝕚𝕔𝕠𝕕𝕖 | ✅ | ✅ | ✅ | | sans_serif | 𝖴𝗇𝗂𝖼𝗈𝖽𝖾 | ✅ | ✅ | ✅ | | bold_sans_serif | 𝗨𝗻𝗶𝗰𝗼𝗱𝗲 | ✅ | ✅ | ✅ | | italic_sans_serif | 𝘜𝘯𝘪𝘤𝘰𝘥𝘦 | ✅ | ✅ | | | bold_italic_sans_serif | 𝙐𝙣𝙞𝙘𝙤𝙙𝙚 | ✅ | ✅ | | | monospace | 𝚄𝚗𝚒𝚌𝚘𝚍𝚎 | ✅ | ✅ | | | regional_indicator | 🇺🇳🇮🇨🇴🇩🇪 | ✅ | | | | circle | Ⓤⓝⓘⓒⓞⓓⓔ | ✅ | ✅ | ✅ | | black_circle | 🅤🅝🅘🅒🅞🅓🅔 | ✅ | | | | square | 🅄🄽🄸🄲🄾🄳🄴 | ✅ | | | | parenthesized | 🄤⒩⒤⒞⒪⒟⒠ | ✅ | ✅ | | | fullwidth | Unicode | ✅ | ✅ | ✅ |

Notice

regional_indicator is the characters that represents national/regional flags. In some environment (like Discord), these characters are basically interpreted as flags emoji. For example, JOIN US will be shown as JO (Jordan) IN (India) US (United States) like below. This is not a bug of this library.

national flags

Fallback Option

Some fonts don't have characters for small letters. In that case, if you turn on the fallback option, this returns existing capital letters instead of (unexisting) small ones.

let tokyoTower1 = utd.decorate('Tokyo Tower', 'black_circle'); // default is false
let tokyoTower2 = utd.decorate('Tokyo Tower', 'black_circle', { fallback: true });
let tokyoTower3 = utd.decorate('Torre de Tóquio','black_circle', { fallback: true });

console.log(tokyoTower1);
console.log(tokyoTower2);
console.log(tokyoTower3);

expected output

Even with the fallback mode, unexisting characters (non-ASCII like ó ) will be ignored.

🅣okyo 🅣ower
🅣🅞🅚🅨🅞 🅣🅞🅦🅔🅡
🅣🅞🅡🅡🅔 🅓🅔 🅣ó🅠🅤🅘🅞