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

noahsark

v0.0.12

Published

utils

Downloads

3

Readme

NoahsArk

砍柴少侠|少侠记

NPM 地址

这是一个自己在开发 web 和 Taro 小程序时,经常用到的函数包。为了方便复用。封装成了 NPM 包

颜色处理 Color:

图片平均色
  colorfulImg(图片地址:string)
  # return rgba(x,x,x,x)

hex转rbga
  hex2Rgba(hex:string, 透明度:number)
  # return rbg(x,x,x,x||1)

dom:

拖动dom元素
  moveElement(触发拖动元素:Element, 被拖动元素:Element, 是否被移出屏幕:boolean)

utils:

设备信息【不支持小程序】
  browser()
  return {iOS: true|false, android, iPhone, webKit, weChat, ...很多型号}

深拷贝 支持 Array Object Date RegExp 等常见数据类型
  deepClone(data)
  # return data

计算经纬度之间的距离
  getDistance(lat1:number, lng1:number, lat2:number, lng2:number)
  # return number

获取当前时间(鸡肋,用dateFormat)
  getCurrentTime()
  # return '年-月-日 时:分:秒'

格式化时间
  例如 dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss.S") ==> 2020-07-02 08:09:04.423
  dateFormat(Date, 格式)
  # return 'x-x-x 时:分:秒'

base64转二进制
  base64Img2Blob(base64)
  # return Blob

数组分割
  groupArray(array, size)
  # return [[],[]]

对比两个对象是否一样
  deepEqual(obj, obj)
  # return boolean

第三方 Api

调用第三方地图app打开目标地点,支持iOS和Android
  openMapApp(lng:number, lat:number, address:string)
  # 会调用其中一个App【高德地图、百度地图、腾讯地图】
  # iOS系统会多一个【苹果地图】