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 🙏

© 2024 – Pkg Stats / Ryan Hefner

sf-utils2

v3.2.1

Published

> 主要把平时用到的工具函数封装起来,🚀 为简化开发而生,里面主要涉及到 `基础数据类型校验`、`懒加载`、`数据结构转化`、`浮点型数学计算`、`拓展` 等

Downloads

10

Readme

sfutils

主要把平时用到的工具函数封装起来,🚀 为简化开发而生,里面主要涉及到 基础数据类型校验懒加载数据结构转化浮点型数学计算拓展

文档这里 👇

1.快速开始

npm 安装

npm i sf-utils2

yarn 安装

yarn add sf-utils2

pnpm 安装

pnpm add sf-utils2

cdn 方式

<script src="https://cdn.jsdelivr.net/npm/sf-utils2/lib/index.umd.min.js"></script>

2.使用

esm 使用

// 运行在esm中
import sfutils from 'sf-utils2'

sfutils.uuid()

cdn 使用

window.sfutils.uuid()
// Type.isNumber

sf-utils2提供一些基础对 dom、数据层面的转化、懒加载等方法,为简化开发、提高效率而生。 里面主要提供 基础-Base对象-Object数组-Array方法-Function字符串-String数学-Mathdom拓展模块

  • 基础-Base 基础公共方法
  • 对象-Object 操作对象方法封装
  • 数组-Array 操作数组方法封装
  • 方法-Function Function 方法封装
  • 字符串-String 字符串方法封装
  • 数学-Math 支持精确的 js 浮点型运算。
  • dom 封装大量对 dom 便捷操作
  • 拓展 一些拓展方法,大多数是依赖第三方库进行封装方法。即:需要安装第三方库。或者一些方法占据内容过大,如对某一区域内部,文章图片懒加载,非常适用于服务端返回一串不规则的 html,里面夹杂着图片

愿景 我的愿景就是能够快速相应开发,省去写平时大量用到的工具方法。

warning ⚠️ 注意 🎲 表示用的比较少,考虑下一版本去除。 🔥 代表 比较常用的方法

2、cdn 方式引入

<!-- 引入js -->
<script src="https://cdn.jsdelivr.net/npm/sf-utils2/lib/index.umd.min.js"></script>

建议 我们建议使用 CDN 引入 sf-utils2 的用户在链接地址上锁定版本,以免将来 sf-utils2 升级时受到非兼容性更新的影响。锁定版本的方法请查看 https://www.jsdelivr.com/

为什么选择 sf-utils

  • 体积小,支持按需加载
  • 放开现在任何工具库,暂时还没提供丰富的对递归一些数据转化的方法,这个非常适用于前端开发对接权限信息时或者其他业务场景中用到。比如遇到后端偏懒,只返回一层的 数据结构,并没有返回想要的数据结构,要么后端做处理,要么前端擦屁股。
  • 对平时用到的 webpack、vite 等主流的工程化项目,提供自动注入文件。
  • 提供便捷、准确的数据类型判断
    • 丰富的 dom 基础操作方法。