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

@flyto/utils-core

v1.2.0

Published

通用工具函数库,提供日期处理、事件通信、数据解析等基础能力。

Readme

@flyto/utils-core

通用工具函数库,提供日期处理、事件通信、数据解析等基础能力。

特性

  • 不依赖应用运行时
  • 无副作用
  • 与具体业务解耦
  • 支持 Tree Shaking
  • 可用于 Vue / 非 Vue 项目

安装

npm install @flyto/utils-core

使用

import { getNowTimeRange, throttle, debounce, parseAddress } from '@flyto/utils-core'

// 日期范围
getNowTimeRange(7, 'day', 'YYYY-MM-DD')

// 函数节流
throttle(myFunc, 1000)

// 地址解析
parseAddress('北京市朝阳区某某路123号')

API 概览

日期处理 (format)

| 函数 | 说明 | |------|------| | getNowTimeRange | 获取基于当前时间的时间范围 | | formatMoney | 格式化数字为金额 | | formatCNYMoney | 格式化数字为人民币金额 | | formatKeyValueToFullName | 拼接键值对为标准显示格式 |

类型判断 (is)

| 函数 | 说明 | |------|------| | isArray | 检查是否为数组 | | isObject | 检查是否为对象 | | isString | 检查是否为字符串 | | isNumber | 检查是否为数字 | | isFunction | 检查是否为函数 | | isEmptyObject | 检查是否为空对象 | | isUrl | 检查是否为有效 URL |

事件处理 (event)

| 函数 | 说明 | |------|------| | addEventListen | 添加元素事件监听 | | removeEventListen | 移除元素事件监听 |

Canvas 操作 (canvas)

| 函数 | 说明 | |------|------| | drawMediaToCanvas | 将媒体元素绘制到 Canvas |

颜色处理 (color)

| 函数 | 说明 | |------|------| | hexToRgb | 十六进制颜色转 RGB | | rgbToHex | RGB 转十六进制颜色 | | colorGradient | 颜色渐变 | | calculateColor | 计算颜色深浅 | | generateColorByBlackText | 生成适配黑色文字的颜色 |

网络操作 (network)

| 函数 | 说明 | |------|------| | downloadBlob | 下载文件为 Blob 并显示进度 | | transBlobToFileDownload | Blob 转为文件下载 |

工具函数 (common)

| 函数 | 说明 | |------|------| | throttle | 函数节流 | | debounce | 函数防抖 | | openWindow | 新窗口打开 URL | | parseAddress | 地址解析 | | checkWaybillNumber | 运单号校验 |

信号量 (signal)

| 函数 | 说明 | |------|------| | createLatestSignal | 创建最新值信号 |

定时任务 (task-scheduler)

| 类 | 说明 | |------|------| | TaskScheduler | 定时任务调度器 |

构建

pnpm build

License

MIT