1.0.4 • Published 3 years ago

emoji-handle v1.0.4

Weekly downloads
88
License
ISC
Repository
github
Last release
3 years ago

emoji-handle

The string contains the processor of Emoji

Feature

  • 字符串中emoji替换unicode
  • 修正字符串 只保留 中文 大小写英文字母 阿拉伯数字 小数点 emoji表情

Installation

$ npm i emoji-handle

Useing

字符串中emoji替换unicode示例:

const { emojiToUnicode } = require('emoji-handle');
const result = emojiToUnicode('李大猫😀');
console.log(result);
// output: 李大猫\\u{1F600}

修正字符串

只保留 中文 大小写英文字母 阿拉伯数字 小数点 示例:

const { repair } = require('emoji-handle');
const result = repair('佛系大宝宝🌟𐂂 ☾˚‧º·');
console.log(result);
// output: 佛系大宝宝

只保留 中文 大小写英文字母 阿拉伯数字 小数点 emoji表情 示例:

const { repair } = require('emoji-handle');
const result = repair('佛系大宝宝🌟𐂂 ☾˚‧º·', true);
console.log(result);
// output: 佛系大宝宝🌟

𝙂𝙡𝙤𝙧𝙞𝙖𝘿☺︎ 全部是特殊符号返回空字符串 长度为0 需要人工处理