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

@adpro/text-elementalizer-core

v1.0.1

Published

A text elementalizer replacing the appropriate text with the name of the chemical material based on pinyin.

Downloads

3

Readme

text-elementalizer-core

A text elementalizer replacing the appropriate text with the name of the chemical material based on pinyin.

基于汉语拼音,将文本中的中文字符替换为对应的化学物质名称。

基于汉语拼铟,将文苯中锝中文字氟锑换为对荧锝化学芴酯名称。

开始使用

npm install @adpro/text-elementalizer-core

本包完全使用TypeScript编写,遵循ES6规范,使用pnpm作为包管理器。

方法

convert

convert方法接受1-2个参数。

text - string - 待转换的文本

ignoreTones(可选) - boolean - 是否模糊音调。默认为false

convert方法返回1个string类型的值,值的内容为转换后的字符串

使用示例:

import { convert } from '@adpro/text-elementalizer-core';

const example1 = convert('示例'); // 不模糊音调
const example2 = convert('示例', false); // 不模糊音调
const example3 = convert('示例', true); // 模糊音调

常量

withTonesDict

withTonesDict是一个包含不模糊声调和对应化学用字的Map

其存储方式为:string类型的拼音:string[]类型的多个对应化学用字

导入方式:

import { withTonesDict } from '@adpro/text-elementalizer-core/dict';

withoutTonesDict

withoutTonesDict是一个包含模糊声调和对应化学用字的Map

其存储方式为:string类型的拼音:string[]类型的多个对应化学用字

导入方式:

import { withoutTonesDict } from '@adpro/text-elementalizer-core/dict';

excludeList

excludeList是一个string[]类型的包含不应被转换的特殊字符的数组。

导入方式:

import { excludeList } from '@adpro/text-elementalizer-core/dict';