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

pu-utilsjs

v0.0.34

Published

> 记录平时常用小工具集合

Downloads

1

Readme

pu-utilsjs

记录平时常用小工具集合

Initial

npm install pu-utilsjs
使用方法
import utilsjs from 'pu-utilsjs';

| 函数 | 参数 | 备注 | | ------------ | ------------------------ | --------------------------------------------------------------------------------------------------------------------------- | | debounce | debounce(函数,1000) | 返回防抖函数函数,单位为毫秒 | | defTime | defTime(1,false) | 返回当前月份往前推的时间区间,true 为当前的时间前推,false 是当前月份往前推 | | cuFile | cuFile(文件,5,false) | 文件分切处理,布尔值用于绝对是否使用 MD5 作为 hash 值 | | encrypt | encrypt(内容,key,true) | 加密默认采用 MD5 作为 key,第三个参入为真的话是把您传入的 key 转为 MD5,函数返回对象 | | decrypt | decrypt(密文,key) | 返回解密结果,key 必须与加密时的 key 一样 | | MaxNum | MaxNum(数字 1,数字 2) | 返回两数之和 | | downloadFile | downloadFile(Blob,'pdf') | 文档流下载,第二入参如:pdf,doc,xls,ppt,zip,也可传入其他的类型如:text/plain、application/x-tar,第四个入参是否检验第一入参类型 |

数字最大之和

import { MaxNum } from 'pu-utilsjs';

MaxNum('12345678987654321', '12345678987654321'); //24691357975308642

获取时间区间

import { defTime } from 'pu-utilsjs';

defTime(1); //['2024-03-01', '2024-03-31']
defTime(1, true); //['2024-02-18', '2024-03-18']

文件切片

import { cuFile } from 'pu-utilsjs';

cuFile(File);

内容加密

import  {encrypt,decrypt} from "pu-utilsjs"

encrypt(value,'123456'){
    return {key:string,value:string}
}  //加密
decrypt(value,'123456'):string  //解密

文档流文件下载

import { downloadFile } from 'pu-utilsjs';

// 'pdf' | 'doc' | 'docx' | 'xls' | 'xlsx' | 'ppt' | 'pptx' | 'zip'
downloadFile(Blob, 'doc', 'word文件');

防抖函数

//<span @click="init(1,2,3)">点击</span>
import { debounce } from 'pu-utilsjs';
const init = debounce((a, b, c) => {
	console.log(a, b, c);
}, 1000);