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

ecton-utils

v1.0.2

Published

通用方法工具包

Downloads

2

Readme

描述

通用方法工具包

Author

易通-预付卡研发部-前端团队

方法引入方式, 支持 单独引入 与 全部引入 两种方式

** 单独引入方式如下: **

  import { arrayRemove } from 'ecton-utils'

** 全部引入方式如下: **

  import * as Utils from 'ecton-utils'

方法说明

  • isArray 判断数据类型是否为数组
  • isObject 判断数据类型是否为对象
  • isString 判断数据类型是否为字符串
  • isNumber 判断数据类型是否为数字
  • isBoolean 判断数据类型是否为布尔
  • isType 检查值是否为特定类型,例:isType(Array, [1]); // true, isType(Map, new Map()); // true
  • isBrowser 检查是否为浏览器环境
  • equals 判断两个深层嵌套的对象是否相等
  • isIdCard 验证身份证号
  • isMobileNum 判断是否手机号
  • detectDeviceType 判断是否移动设备
  • getUrlQuery URL参数处理
  • arrayRemove 删除数组中的某一项
  • randomIntegerInRange 生成指定范围的随机整数,例:randomIntegerInRange(0, 5); // 3
  • randomNumberInRange 生成指定范围的随机小数, 例:randomNumberInRange(2, 10); // 6.0211363285087005
  • round 四舍五入到指定位数,例:round(1.005, 2); // 1.01
  • size 获取不同类型变量的长度
  • trimObj 去除对象中属性的前后空格
  • formatDate 日期格式化
  • clone 深拷贝
  • getCorrectTime 时区时间处理
  • delay 防抖函数
  • findItem 在iniArr中查找符合objArr的数据项,例:
      const arr1 = [11, 22, 33]
      const arr2 = [
        {id:11,a:'s'},
        {id:22,a:'s'},
        {id:33,a:'s'},
        {id:44,a:'s'},
      ]
      findItem(arr1, arr2, 'id')