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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mingto/tools

v1.0.682

Published

明途公共工具库

Downloads

443

Readme

@mingto/tools

一套实用的 TypeScript 工具库,提供类型安全的函数来简化日常开发任务。

特性

  • 🎯 类型安全:完整的 TypeScript 类型定义支持
  • 🔧 功能丰富:涵盖字符串、数组、对象、数学运算、浏览器检测、文件处理等多个领域
  • 📦 轻量高效:按需导入,无冗余代码
  • 🌍 国际化支持:内置多语言切换功能

安装

pnpm add @mingto/tools

功能概览

类型判断

import { isNumber, isString, isObject, isArray } from '@mingto/tools'

isNumber(123) // true
isString('hello') // true
isObject({ a: 1 }) // true
isArray([1, 2, 3]) // true

空值检查

import { checkEmpty, checkObjectEmpty, checkArrayEmpty } from '@mingto/tools'

checkEmpty('') // true
checkEmpty(null) // true
checkEmpty({}) // true
checkEmpty([]) // true
checkEmpty('text') // false

数学运算

import { add, subtract, multiply, divide } from '@mingto/tools'

add(0.1, 0.2) // 0.3 (精确计算,无浮点误差)
subtract(0.3, 0.1) // 0.2
multiply(0.1, 0.2) // 0.02
divide(10, 3) // 3.333...

字符串处理

import { chunkString, objectToQueryString, queryStringToObject } from '@mingto/tools'

chunkString('abcdef', 2) // ['ab', 'cd', 'ef']
objectToQueryString({ a: 1, b: 'x y' }) // 'a=1&b=x%20y'
queryStringToObject('a=1&b=x%20y') // { a: '1', b: 'x y' }

函数工具

import { throttle, debounce } from '@mingto/tools'

const throttledFn = throttle(handleScroll, 500)
const debouncedFn = debounce(handleResize, 300)

浏览器检测

import { isMobile, isPc, isIos, isAndroid } from '@mingto/tools'

isMobile() // true / false
isPc() // true / false
isIos() // true / false
isAndroid() // true / false

文件处理

import { getFileSuffix, getFileName, getFileTitle } from '@mingto/tools'

getFileSuffix('/path/to/file.pdf') // 'pdf'
getFileName('/path/to/file.pdf') // 'file.pdf'
getFileTitle('/path/to/file.pdf') // 'file'

国际化

import tools from '@mingto/tools'

tools.locale('zh-cn') // 设置中文简体
tools.locale('en') // 设置英文
tools.getLocale() // 获取当前语言

完整 API 文档

更多函数和详细用法请参考 官方文档

许可证

MIT