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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@via-cli/str-tools

v0.0.1

Published

字符串处理工具集合,包含字符串处理、正则匹配、日期处理、数字处理等工具

Readme

@via-cli/str-tools

字符串处理工具库 - 提供常用的字符串格式转换、验证、处理等功能

📦 安装

# 使用 npm
npm install @via-cli/str-tools

# 使用 pnpm
pnpm add @via-cli/str-tools

# 使用 yarn
yarn add @via-cli/str-tools

🚀 快速开始

import { StrTools } from '@via-cli/str-tools'

// 命名格式转换
const pascalCase = StrTools.kebabToPascal('my-component-name') // 'MyComponentName'
const camelCase = StrTools.kebabToCamel('my-component-name')   // 'myComponentName'
const kebabCase = StrTools.pascalToKebab('MyComponentName')    // 'my-component-name'

// 字符串处理
const capitalized = StrTools.capitalize('hello world')        // 'Hello world'
const titleCase = StrTools.toTitleCase('hello world')         // 'Hello World'
const truncated = StrTools.truncate('long text', 5)           // 'long...'

// 字符串验证
const isEmpty = StrTools.isEmpty('   ')                       // true
const isEmail = StrTools.isEmail('[email protected]')          // true
const isNumeric = StrTools.isNumeric('123.45')               // true

// 随机字符串生成
const randomStr = StrTools.generateRandomString(8)            // 随机8位字母数字
const randomAlpha = StrTools.generateRandomAlpha(6)           // 随机6位字母
const randomNum = StrTools.generateRandomNumeric(4)           // 随机4位数字

// 字符串搜索和替换
const count = StrTools.countOccurrences('hello world hello', 'hello') // 2
const replaced = StrTools.replaceAll('hello world', 'hello', 'hi')     // 'hi world'

// 字符串格式化
const formatted = StrTools.format('Hello {name}!', { name: 'World' })  // 'Hello World!'
const padded = StrTools.padLeft('123', 6, '0')                         // '000123'

📖 API 文档

🤝 贡献

欢迎提交 Pull Request 或 Issue!

📄 许可证

MIT © 朝阳前端团队