unicd
v1.0.6
Published
en/de unicode(unicode 与 utf 字符串转换)
Downloads
7
Maintainers
Readme
unicode
en/de unicode(unicode 与 utf 字符串转换)
✨ Features
- zero-dependency
- pure-javascript
- unicode 2 utf
- utf 2 unicode
- cjs (CommonJS/Node bundle)
- esm (ES Modules bundle)
- umd (UMD bundle)
- mjs (Modern bundle)
🔨 Usage
📦 NPM
1️⃣ Install
$ npm i --save-dev unicd
2️⃣ Use
import unicd from 'unicd';
// or const unicd = require('unicd');
unicd.de('\ud83d\udc4d'); // 👍
unicd.de('\u597d'); // 好
unicd.en('👍'); // \ud83d\udc4d
unicd.en('好'); // \u597d
🌐 Browser
<!-- ... other HTML ... -->
<!-- load unicd。-->
<script src="://unpkg.com/unicd@latest/dist/index.umd.js" crossorigin></script>
<!-- use unicd。-->
<script>
window.Unicd.de('\ud83d\udc4d'); // 👍
window.Unicd.de('\u597d'); // 好
window.Unicd.en('👍'); // \ud83d\udc4d
window.Unicd.en('好'); // \u597d
</script>