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

aie-tools

v0.0.1

Published

## 项目开始 ``` npm i hjf-tool ``` ``` import tools form 'hjf-tool' ``` ### 使用 ``` import tools form 'hjf-tool'

Downloads

4

Readme

hjf-tools

项目开始

npm i hjf-tool
import tools form 'hjf-tool'

使用

import tools form 'hjf-tool'

//判断当前浏览器是移动端(false)还是pc端(true)
tools.getEnv() // true or false

//isArray 判断是否是数组
tools.isArray([1,2,3]) //true
tools.isArray('1') //false

//isObject 判断是否是对象
tools.isObject({a:1}) //true
tools.isObject('1') //false

//isNumber 判断是否是数字
tools.isNumber(1) //true
tools.isNumber('1') //false

//前端分页
let dataList = [1,2,3,4,5,6,7,8,9,10];
                               // data   page  count
let _dataList = tools.jsPaging( dataList , 1 , 2 ); //  [1,2]

文档地址

所有方法 (只列出了一些)

| 方法名称 | 描述 | 入参 | 返回 | 备注 | |--------------|------------------|-----------------------------------------------------------------------------------------------------------------------------|---------|-----| | getEnv | 判断当前浏览器是移动端还是pc端 | 无 | boolean | | | isArray | 判断是否是数组 | (any) | boolean | | | isObject | 判断是否是对象 | (any) | boolean | | | isNumber | 判断是否是数字 | (any) | boolean | | | hidePhone | 手机号脱敏 | (string) | string | | | hideName | 姓名脱敏 | (string) | string | | | hideEmail | 邮箱脱敏 | (string) | string | | | hideIdCard | 身份证脱敏 | (string) | string | | | hideStr | 脱敏任意字符串 | ( str: string , front?: number , back?: number , _hideStr?: string ) ( 需要脱敏的字符串 , 前面显示几位 , 后面显示几位 , 脱敏后显示的字符串 ) | string | | | jsPaging | 前端JS 分页 | ( data: any[] , page: number , count: number ) ( 需要分页的数组 , 当前页数 , 每页显示多少条 ) | any[] | | | onSubstring | 截取字符串 | ( str: string , start: number , end: number ) ( 需要截取的字符串 , 开始截取的位置(包含) , 截取结束的位置(包含) ) | string | | | downloadFile | 通过 base64 下载图片 | ( data : string , filename ?: string ) ( base64字符串 , 下载的文件名称 ) | void | |