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

@fallen_leaves/fe-utils

v3.0.1

Published

前端工具函数库

Downloads

2

Readme

@fallen_leaves/fe-utils

前端通用工具库

优点:提高前端业务代码开发效率,增强代码复用性

前端开发过程中,会经常用到判断浏览器类型格式化各种日期获取url参数queryString转对象防抖函数节流函数等常用函数,为避免不同项目多次复制粘贴的麻烦,这里统一封装,并发布到npm,以提高开发效率。

安装

  npm install --save @fallen_leaves/fe-utils
  # or
  yarn add @fallen_leaves/fe-utils

使用

  # 完整导入
  import FeUtils from '@fallen_leaves/fe-utils'

  FeUtils.getCookie('user_id')
  # or

  # 模块导入
  import { getCookie } from '@fallen_leaves/fe-utils'

  getCookie('user_id')

API文档

Color

  • hexToRGB  16进制颜色值转rgb格式
  • RGBToHex  16进制颜色值转rgb格式

Cookie

Device

Dom

Function

Number

Object

Regexp

  • RegCollections  常用正则判断函数
    • .isUrl(url)  判段目标字符串是否为url
    • .isPhoneNumber(phoneNumber)  判段目标字符串是否为手机号
    • .isEmail(email)  判段目标字符串是否为邮箱
    • .isIDCard(IDCard)  判段目标字符串是否为身份证号码
    • .isZipCode(zipCode)  判段目标字符串是否为邮政编码
    • .isIE()  判段是否为IE
    • .isChrome()  判段是否为Chrome
    • .isFirefox()  判段是否为Firefox
    • .isOpera()  判段是否为Opera
    • .isSafari()  判段是否为Safari
    • .isEdge()  判段是否为Edge
    • .isAndroid()  判段是否为Android
    • .isIPhone() 判段是否为iPhone
    • .isIPad()  判段是否为iPad
    • .isMacOS()  判段是否为MacOS
    • .isWindows()  判段是否为Windows
    • .isLinux()  判段是否为Linux
    • .isWeChat()  判段是否为微信环境

Time

Url

String

  • urlToLink  目标字符串中的url串转换为<a>标签