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/f-utils

v0.0.15

Published

前端开发常用工具类

Downloads

4

Readme

f-utils

介绍

前端常用工具包

软件架构

软件架构说明

安装教程

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

源码下载

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

使用说明

  • 引入
  • 使用样例(整体引入)
import * as utils from '@mage_1/f-utils'
function test() {
  const obj = {name: '张三', id: 'id123', ot: 'asd'}
  const arr = [obj, {...obj, lk: 'asd'}];
  const otUtl = utils.common.otherUtil, enums = utils.enums;
  console.log('utils===enums=====>',enums.fileTypeExt)
  console.log('utils===isObj=====>',otUtl.isObj(obj))
  console.log('utils===isArray=====>',otUtl.isArray(arr))
  console.log('utils===compare1=====>',otUtl.compare(obj,arr[0]))
  console.log('utils===compare2=====>',otUtl.compare(obj,arr[1]))
  console.log('utils===getMid=====>',otUtl.getMid({name:'张三',id:'id123',ot:'asdfas'},['name','id']))
}
  • 使用样例(按需引入)
import {common,enums} from '@mage_1/f-utils'
function test() {
  const obj = {name: '张三', id: 'id123', ot: 'asd'}
  const arr = [obj, {...obj, lk: 'asd'}];
  const otUtl = common.otherUtil;
  console.log('utils===enums=====>',enums.fileTypeExt)
  console.log('utils===isObj=====>',otUtl.isObj(obj))
  console.log('utils===isArray=====>',otUtl.isArray(arr))
  console.log('utils===compare1=====>',otUtl.compare(obj,arr[0]))
  console.log('utils===compare2=====>',otUtl.compare(obj,arr[1]))
  console.log('utils===getMid=====>',otUtl.getMid({name:'张三',id:'id123',ot:'asdfas'},['name','id']))
}
  • 其中包含

|名称|描述说明|md|类| |--|--|--|--| |名称|描述说明|md|类| |array|数组工具|Array.ts.md|Array.ts| |browser|浏览器相关工具|Browser.ts.md|Browser.ts| |common|部分公共工具StringUtil 字符串相关 NumberUtil 数字相关 DocumentUtil html document 相关FunctionUtil 函数相关FileUtil 文件处理相关OtherUtil 其他常用|Common.ts.md|Common.ts| |datetime|日期时间处理|DateTime.ts.md|DateTime.ts| |enums|常用枚举|enums.ts.md|enums.ts| |geometric|常用几何|Geometric.ts.md|Geometric.ts| |regexp|常用正则|regexp.ts.md|regexp.ts| |storage|本地缓存|Storage.ts.md|Storage.ts| |verify|校验是否|Verify.ts.md|Verify.ts|

  • common

| 函数名 | 描述说明 | |---------------------|-------------------------------| | arr2Tree | 数组转树形结构 | | getFullPathFromTree | 获取数组中某个节点在树形结构中的全路径 | | compare | 比较两个数据是否完全相同一致,数据可为数组或对象 | | distinctArr | 将对象数组根据某些key去重 | | getUid | 获取固定前缀(没有则uid为前缀)的开头的随机id | | getMid | 根据某些键对应的值,将其拼接成字符串来生成MD5类型的id | | ... | ... |

不在此一一列举,可参见各个对应md文档 ...

参与贡献

  1. 小马哥

其他

  • 后续继续完善,陆续更新修复