unicd
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

unicode

Codecov Build Status Downloads npm bundle size License

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>

🥂 License

MIT

Package Sidebar

Install

npm i unicd

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

18.9 kB

Total Files

13

Last publish

Collaborators

  • jiangzhiguo2010