Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A JavaScript library for processing Japanese vertical text, handling Tate-Chu-Yoko and text orientation adjustments
TCY is a JavaScript library for processing Japanese vertical text. It adds special classes to HTML elements for handling Tate-Chu-Yoko (vertical-in-horizontal text) and text orientation adjustments.
npm install tcy
import TCY from 'tcy';
// Basic usage
const result = TCY.transformText('令和25年度の調査では、約78%の回答者が賛成しました。');
// => 令和<span class="tcy">25</span>年度の調査では、約<span class="tcy">78</span>%の回答者が賛成しました。
// With options
const result2 = TCY.transformText('第123回目の検証実験で、約456件のデータを収集。', { tcyDigit: 3 });
// => 第<span class="tcy">123</span>回目の検証実験で、約<span class="tcy">456</span>件のデータを収集。
Option | Type | Default | Description |
---|---|---|---|
tcyDigit | number | 2 | Maximum number of digits for Tate-Chu-Yoko. Set to 0 to disable number conversion. |
autoTextOrientation | boolean | true | Enable/disable automatic text orientation adjustment. |
<span class="tcy">12</span>
<span class="tcy">!!</span>
<span class="sideways">÷</span>
<span class="upright">α</span>
Set NODE_ENV=development
during development to enable detailed debug output:
NODE_ENV=development node your-script.js
When invalid HTML is input, the library returns the original text and outputs an error message.
// Default behavior (tcyDigit: 2)
TCY.transformText('新宿駅の1日の利用者数は約35万人です。');
// => 新宿駅の1日の利用者数は約<span class="tcy">35</span>万人です。
// With tcyDigit: 0 (disable number conversion)
TCY.transformText('新宿駅の1日の利用者数は約35万人です。', { tcyDigit: 0 });
// => 新宿駅の1日の利用者数は約35万人です。
// Automatic text orientation
TCY.transformText('÷∴≠α');
// => <span class="sideways">÷</span><span class="sideways">∴</span><span class="sideways">≠</span><span class="upright">α</span>
// Disable text orientation
TCY.transformText('÷∴≠α', { autoTextOrientation: false });
// => ÷∴≠α
MIT
FAQs
A JavaScript library for processing Japanese vertical text, handling Tate-Chu-Yoko and text orientation adjustments
We found that tcy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.