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 🙏

© 2026 – Pkg Stats / Ryan Hefner

elfin

v1.0.5

Published

这是一个常用的JS插件库

Readme

安装

npm install elfin

使用方式

在vue项目main.js中使用:

import Vue from 'vue';
import elfin from 'elfin';

Vue.use(elfin);
this.$elfin.getNowDate();

日期函数操作

formatTime(date, mark)   date:Date参数;   mark:年月日分隔符号,默认“-”;   return “YYYY-MM-DD HH:mm:ss” getNowDate(mark)   mark:年月日分隔符号,默认“-”;   return “YYYY-MM-DD HH:mm:ss” formatYMD(date, mark)   date:Date参数;   mark:年月日分隔符号,默认“-”;   return “YYYY-MM-DD” formatHMS(date)   date:Date参数;   return “HH:mm:ss” formatWeek(date)   date:Date参数;   return “星期一” formatNumber(num)   num:数字;   return 个位数会在前面加上“0”

localStorage、sessionStorage存储操作

setLocal(key,value)   key:localStorage键值;   value:可以为任何对象; getLocal(key)   key:localStorage键值;   return:localStorage的存储,取之前存得值,不过返回得都是字符串; delLocal(key)   key:localStorage键值;   注:localStorage的存储,删之前存得值; setSession(key,value)   key:sessionStorage键值;   value:可以为任何对象; getSession(key)   key:sessionStorage键值;   return:sessionStorage的存储,取之前存得值,不过返回得都是字符串; getSessionObj(key)   key:sessionStorage键值;   return:sessionStorage的存储,取之前存得对象,直接返回对象; delSession(key)   key:sessionStorage键值;   注:sessionStorage的存储,删之前存得值; delAllSession()   注:sessionStorage的存储,删之前所有存得值;

数组相关操作

arrIn(arr, item)   arr:目标数组;   item:需要判断得元素;   return true就是包含,false就是不包含 arrDel(arr, item)   arr:目标数组;   item:需要删除得元素;   return 处理后得数组 arrRandom(arr)   arr:目标数组;   return 输入数组,会随机抽取数组中得一个值输出 arrRepeat(arr)   arr:目标数组;   注: 数组去除重复 arrMax(arr)   arr:目标数组;   return 数组最大值 arrMin(arr)   arr:目标数组;   return 数组最小值 arrSort(arr,order)   arr:目标数组;   order:需要判断得元素;   return 排序后数组

字符串相关操作

strCut(str, length)   str:目标字符串;   length:需要的长度;   return 截取后的字符串 strTrim(str)   str:目标字符串;   return 清除空格之后的字符串

其他操作

getSumFunc(...nums)   注:不定参数求和; toThousands(num,cent,isThousand)   num:需要转换的对象可以是数字字符串或数字;   cent:需要保留的小数点后的位数,默认2;   isThousand:是否以千分位显示,默认1,只有两个值1、0;   return “10,000.00”; reBirtyhday(idNum, mark)   idNum:身份证号码;   mark:连接符号,默认“-”;   return:“1987-09-28”;