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

toolite

v0.0.6

Published

toolite

Downloads

80

Readme

toolite

一个简易的人工具库

如何使用

1. 安装
yarn add toolite --save
npm install toolite --save
2. 引入
import toolite from 'toolite'    
3. 使用
可以在使用的地方直接引入整个工具或者单个函数    
个人喜欢以下操作以便于在script和template中全局使用    
在main.ts中加入以下代码    
declare module '@vue/runtime-core' {
    interface ComponentCustomProperties {
        $toolite: typeof toolite
    }
}     
window.$toolite = toolite     

const app = createApp(App)   

app.config.globalProperties.$toolite = toolite     

在vite-env.d.ts中加入以下代码       

interface Window {
    $toolite: typeof import('toolite').default
}      
4. 函数简单介绍

| 函数名 | 简单描述(具体函数参数可在使用时看ts提示) | | --------------------- | ------------------------------ | | dateFormat | 格式化时间 | | dateDiff | 计算时间差,不局限于天,月等单位 | | getDateByTimeOffset | 根据指定的起始时间、时间偏移量、时间单位和返回时间格式获取相应的日期时间 | | isTimeWithinIntervals | 检查给定的时间是否在一组时间区间内(针对于格式为HH:mm:ss的时间) | | isTimeRange | 指定开始和结束时间,判断时间是否在此范围内(HH:mm:ss) | | exportExcel | 导出数据为 Excel 文件 | | setPosition | 根据角度和半径指定元素位置,支持自定义圆心位置,起始角度和旋转方向 | | formatNumber | 安全截断数值(不四舍五入),避免科学计数法和精度丢失问题 | | getAngle | 计算从两点的角度(以度为单位),角度范围在 0 到 360 度之间 | | getMouseAngleToDom | 计算鼠标位置相对于指定 DOM 元素中心点的角度 | | hexToRgba | 将十六进制颜色值转换为带有透明度的 RGBA 颜色值字符串 | | downloadFile | 下载文件 | | debounce | 防抖 | | throttle | 节流 | | deepClone | 深克隆 |