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

dap-util

v1.6.2

Published

一个轻量的前端JavaScript工具库,专注于JavaScript,不关心UI

Readme

dap-util

npm version license

一个不依赖于任何库的工具性质的 JS 库,提供大量工具函数方便日常开发。

特性

  • 零依赖,轻量纯净
  • 完整 TypeScript 类型支持
  • 按模块组织,支持按需引入
  • 涵盖颜色、DOM、事件、文件、数字、字符串、平台检测、语音合成等常用场景

安装

# npm
npm install dap-util

# 安装指定版本
npm install [email protected]
# yarn
yarn add dap-util

# yarn 安装指定版本
yarn add [email protected]
# pnpm
pnpm add dap-util

# pnpm 安装指定版本
pnpm add [email protected]

CDN 使用

<!-- 引入固定版本 -->
<script src="https://unpkg.com/[email protected]/lib/dap-util.umd.js"></script>
<!-- 始终引入最新版本 -->
<script src="https://unpkg.com/dap-util/lib/dap-util.umd.js"></script>

快速上手

npm/yarn/pnpm 引入

import Dap from 'dap-util'

// 调用 platform 模块的 device 方法获取运行设备信息
const result = Dap.platform.device()

// 调用 common 模块的 isObject 方法判断是否为对象
const isObj = Dap.common.isObject(val)

按需引入

import { platform } from 'dap-util'
const result = platform.device()
import { common } from 'dap-util'
const isObj = common.isObject(val)

CDN 引入

const Dap = window.Dap
const result = Dap.platform.device()

模块

| 模块 | 说明 | |------|------| | color | 颜色相关工具(RGB/HSV/HEX 互转等) | | common | 通用工具(正则匹配、对象比较、深克隆等) | | data | DOM 数据存取(element 上附加自定义数据) | | element | DOM 操作(尺寸、滚动、类名、CSS 读取等) | | event | 事件绑定/解绑管理 | | file | 文件处理(图片压缩、Base64 转换等) | | number | 数字处理(格式化、精确四则运算等) | | platform | 平台/设备/浏览器/系统检测 | | speech | 语音合成(Web Speech API 封装) | | string | 字符串处理(插入、删除、替换、去空格等) |

文档

完整文档请访问:https://www.so-better.cn/docs/dap-util/

License

MIT