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

@mage_1/frontend-utils

v0.0.15

Published

前端开发常用工具类

Readme

frontend-utils

介绍

前端常用工具包

软件架构

软件架构说明

安装教程

  • npm install @mage_1/frontend-utils
  • npm i @mage_1/frontend-utils
  • yarn add @mage_1/frontend-utils

源码下载

https://gitee.com/mage_1/frontend-utils.git

使用说明

  • 引入

import * as utils from '@mage_1/frontend-utils'

其中包含

  • common 常用公共工具
  • storage 缓存工具
  • format 格式化工具
  • regexp 正则工具
  • enums 常用枚举工具
  1. common

| 函数名 | 描述说明 | |---------------------|-------------------------------| | arr2Tree | 数组转树形结构 | | getFullPathFromTree | 获取数组中某个节点在树形结构中的全路径 | | isObj | 判断数据是否为对象 | | isArray | 判断数据是否为数组 | | compare | 比较两个数据是否完全相同一致,数据可为数组或对象 | | distinctArr | 将对象数组根据某些key去重 | | getUid | 获取固定前缀(没有则uid为前缀)的开头的随机id | | getMid | 根据某些键对应的值,将其拼接成字符串来生成MD5类型的id | | isElectron | 是否是Electron应用 | | isWindows | 是否是Windows操作系统 | | isMacOS | 是否是MacOS操作系统 | | getFileExtension | 获取文件后缀名 | | getFileMime | 获取文件MIME类型 | | getFlatObjectArray | 将嵌套结构对象数组,转换为单层结构对象数组 | | ... | ... |

  1. storage

| 函数名 | 描述说明 | |-------------|-----------| | session | session处理 | | local | local处理 | | CurrentUser | 当前用户处理 |

  1. format

| 函数名 | 描述说明 | |-------------------------|----------| | formatDatetime | 日期时间格式化 | | formatThousandSeparator | 数字千分位表示法 |

  1. regexp

| 函数名 | 描述说明 | |----------|-------------| | email | 电子邮箱地址 | | mobile | 中国大陆手机号码 | | iDCardNo | 中国大陆居民身份证号码 | | ... | ... |

  1. enums[文件后缀名->MIME映射]

| 函数名 | 描述说明 | |-------------|---------------| | fileTypeExt | 文件后缀名->MIME映射 |

参与贡献

  1. 小马哥

特技

  • 后续继续完善