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

wechat-square-bracket-emotions

v1.0.5

Published

handle wechat [xx] emotions

Downloads

15

Readme

getting started

wechat-square-bracket-emotions 是用来处理微信[XX]类型表情的一个类库

安装

npm install --save wechat-square-bracket-emotions

引用

// es6
import { WxEmotions } from 'wechat-square-bracket-emotions'
// umd
const { WxEmotions } = require("wechat-square-bracket-emotions")
// alias
import { WxEmotions as alias } from 'wechat-square-bracket-emotions'
const alias = require("wechat-square-bracket-emotions").WxEmotions

使用

const { WxEmotions } = require("wechat-square-bracket-emotions")
const We = new WxEmotions()
// 解析段落
We.parse('你好[微笑]') // "你好<img src="https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/0.gif" alt="['微笑']">"
// 单独解析表情文字
We.textToImage('微笑') // "<img src="https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/0.gif" alt="[微笑]">"

Usage

params

config

interface configInterface {
  emotionsMap: {},
  emotionsBaseUrl: string,
  silent: boolean
}
  • emotionsMap 如果传入该值,则使用自定义的id与表情文字Map
  • emotionsBaseUrl 如果传入该值,则使用自定义路径中的gif图片(0.gif - 104.gif)
  • silent 默认为true,为false时遇到错误会throw Error

properties

  • textToIdMap getter
  • idToTextMap getter
  • emotionSrcList getter

methods

  • parse
  • textToImage
  • idToText

others

建议使用npm提供的Try it out功能進行试用(需选用node 6)

Contribution

dev

npm run dev

test

npm (run) test

release

  • 0.1.0 更新(更正)依赖;添加中文关键字
  • 1.0.0 修复部分bug;使用typescript重写src代码
  • 1.0.4 完善打包配置