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

luo-tools

v1.1.8

Published

这是一个工具类,放置平常使用平率比较高的一些方法

Downloads

14

Readme

常用的方法

  1. 节流

示例 throttle(handler,wait); handler方法 wait等待时间默认3000

  1. 地址栏截取某个参数

getUrlParam(name) name参数名

  1. 正则截取某个参数(哈希地址不适应)

getQueryVariable(name) name参数名

  1. 时间格式化

timeFormat(data,type)

| 参数 | 说明 | 类型 | | :-----: | :----: | :----: | | data | 时间参数 | String Number | | type | 类型(默认1) | String Number |

type值说明

| type | 说明 | | :-----: | :----: | | 1 | YY-MM-DD HH:mm:ss | | 2 | YY-MM-DD | | 3 | YY/MM/DD HH:mm:ss | | 4 | YY-MM-DD HH:mm | | 5 | YY/MM/DD HH:mm | | 6 | YY/MM/DD | | 7 | YY/MM |

  1. 过js来获取前天、昨天、今天、明天、后天、大后天的日期

getDateStr(AddDayCount=0,type=1)

| 参数 | 说明 | 类型 | | :-----: | :----: | :----: | | AddDayCount | 获取哪一天的参数:-2前天、-1昨天、0今天、1明天...依次类推(默认今天0) | String/Number | | type | 类型(默认1)1:YY-MM-DD 2:YY/MM/DD | String/Number |

  1. 聊天时间格式,类似刚刚、一分钟前

timestampFormat(timestamp),13位时间戳

  1. 判断是否有必填项没填

validCheck(obj, filterArr=[])

| 参数 | 说明 | 类型 | | :-----: | :----: | :----: | | obj | 传入的对象 | Object | | filterArr | 过滤数据(默认[]) | Array |

  1. 内联样式无法转换需要使用这个转换(移动端使用)

px2rem(px,rootVal=37.5)

| 参数 | 说明 | 类型 | | :-----: | :----: | :----: | | px | 传入的像素(eg:'14px') | String | | rootVal | 这里的rootVal,和rootValue值对应 | Number |