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

emoji-convert

v1.0.1

Published

emoji表情的转换。

Downloads

3

Readme

emoji表情的转换。

  1. 将unicode字符转换为[xxx]的文本格式

  2. 将emoji表情和[xxx]格式的文本转换为图片

  3. 将[xxx]格式的文本转换为unicode字符。

下载

  • npm: npm install --save emoji-convert
  • 直接下载: http://wangwl.net/static/demo/emoji-convert/index.js

使用

  • es2015: import convert from "emoji-convert"
  • commonjs: var convert = require("emoji-convert")
  • amd: define( ["/js/emoji-convert.js"] , (convert)=>{ /*...*/ } )
  • window.emojiConvert: <script src="http://wangwl.net/static/demo/emoji-convert/index.js"></script>
  • self.emojiConvert: importScripts("./emoji-convert.js")

demo

http://wangwl.net/static/demo/emoji-convert/index.html

示例

//npm install emoji-convert
//npm install emoji-convert-resource-base

import source from 'emoji-convert-resource-base';
import convert from 'emoji-convert';

convert.extend(source);

convert.toUnicode('[大笑]');        //"\u{1f604}"
convert.toText('\u{1f604}');       //"[大笑]"
convert.toHtml('[大笑]');          //<img class="emoji-daxiao" src="https://static.ws.126.net/f2e/modules/emoji/lib/emoji/704.png" alt="[大笑]">
convert.toHtml('\u{1f604}');       //<img class="emoji-daxiao" src="https://static.ws.126.net/f2e/modules/emoji/lib/emoji/704.png" alt="[大笑]">

API

toUnicode(msg)

function (msg:string) : string

解析msg字符串,将[xxx]格式的字符转换为emoji字符。

toText(msg)

function (msg:string) : string

解析msg,将其中的emoji字符转换为[xxx]格式的字符。

toHtml(msg)

function (msg:string) : string

将emoji字符和[xxx]格式的字符转换为img标签。

extend(list)

function ( list:array<item>) : void item: {text: string, class: string, url:string, code:?string}

添加表情资源。例如

convert.extend([{
    text:'大笑1',
    class:'daxiao1',
    url:'http://163.com',
    code:'\u{1f604}'
}]);
convert.toUnicode('[大笑1]');     //"\u{1f604}"
convert.toText('\u{1f604}');      //[大笑1]
convert.toHtml('[大笑1]');         //<img class="daxiao1" src="http://163.com" alt="[大笑1]">
convert.toHtml('\u{1f604}');      //<img class="daxiao1" src="http://163.com" alt="[大笑1]">