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

km-util

v1.1.1

Published

常用方法集合

Downloads

9

Readme

KM 工具集合

使用

1.安装

// 1.1.0 及以上引入
import { kmUtil } from 'km-util'

// 1.0.0 版本引入
import kmUtil from 'km-util'

2.使用

// 引入
import { kmUtil } from 'km-util'

// 使用
console.log(kmUtil.getRandom(6)) // 获取随机数

3.工具集详情

| 导出项 | 说明 | |-------|------| | kmUtil | 常用方法集合 | | kmTimeUtil | 时间方法集合 |

  • kmUtil 方法集

    | 方法 | 参数(按顺序) | 参数说明 | 返回值 | 方法说明 | |-------|------|-------|------|------| | LS | flag: get/set/remove/clearkey: stringvalue?: any | flag:缓存操作类型key:缓存 key 值value:需要保存时值(保存时必须) | object/string | 缓存操作函数 | | getRandom | num?: numberflag?: all/number/string | num(默认: 6): 随机个数flag(默认: all): all:字母+数字 | number:数字 | string:字母 | string | 获取随机数字或字母 | | judgeFileType | path: string | path: 文件路径 | 'image'/'video'/'office'/'other' | 判断文件类型 | | phoneFormatToStar | phone: string | phone: 手机号 | string | 将手机号中间标上 * 号 | | regTest | str: stringreg: string/RegExp | str: 字符串reg: phone:判断手机号 | email:判断邮箱 | RegExp:正则表达式 | boolean | 判断当前字符串是否满足正则 |

  • kmTimeUtil 方法集

    | 方法 | 参数(按顺序) | 参数说明 | 返回值 | 方法说明 | |-------|------|-------|------|------| | getNowStamp | time?: Date/number/string | time: 时间格式字符串或时间对象 | number | 获取当前时间戳(秒级) | | getNowDateStamp | | | number | 获取当天零点时间戳(秒级) | | timeToFormat | time?: Date/numberformatStr?: string | time: 秒级时间戳、时间对象formatStr(默认:{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}): 转换的时间格式。默认转换成 2023-01-10 12:02:10 | number | 获取当天零点时间戳(秒级) |

更新日志

1.1.0

  1. 更换引入方式(重要)

    import { kmUtil } from 'km-util'
  2. 更新多个方法

1.0.0

首次发布