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

ahwater-prototype

v1.3.23

Published

原型扩展工具。

Downloads

96

Readme

改写了vue3的支持 增加分辨率提示关闭功能

window 基础类型原型扩展工具。


对window、string、array、date、vue对象进行扩展


安装

via npm:

npm install pinyin

用法

开发者:

var Prototype = require("Prototype"); 

API - window

debounce window.debounce(fn[, delay])

防抖,不用多说

API - String

  • get

<Boolean> "abc".get("c")

从字符串中查询是否存在指定的字符/字符串

  • data_string

<String> "/Date(1333245600000+0800)/".data_string()

把长格式的时间 转换为 正常格式

  • getExt

<String> "aaaaa.shp".getExt()

对文件名的处理,提取字符串里面的最后一个点.后面的为后缀名

  • changeExt

<String> "aaaaa.shp".changeExt("bb")

更改后缀名

  • getName

<String> "aaaaa.shp".getName()

提取文件名

  • ClearBr

"ffff\r\nff".ClearBr()

字符串里面的换行符全部移除

  • Trim

<String> " aaa aa.shp ".Trim()

字符串里面的空白全部移除

  • getExt

<String> " aaaaa.shp ".TrimLeft()

字符串里面左侧的空白移除

  • getExt

<String> " aaaaa.shp ".TrimRight()

字符串里面右侧的空白移除

  • trimStartEnd

<String> " aaaaa.shp ".trimStartEnd()

字符串里面两侧的空白移除

  • IAN

<String> "123qw".IAN()

判断是否为由数字组成的字符串

  • has

<String> "aaaaa.shp".has("a")

判断是否存在指定字符

  • hases

<String> "aaaaa.shp".hases(["a","b"])

存在指定指定字符数组中的至少一个

  • hasno

<String> "aaaaa.shp".hasno("a")

判断是否不存在指定字符

API - Array

  • remove

[1,2,3,4,5].remove(3)

从数组中移除指定的值

  • clone

[1,2,3,4,5].clone()

浅拷贝数组对象

  • fresh

[1,2,3,4,5].fresh()

刷新数组

  • trim

[1,2,3,4,5].trim()

移除数组中空白

  • has

[1,2,3,4,5].has(2)

判断数组中是否存在指定项

API - Date

  • Format

date.Format([option])

日期格式化,默认为 "yyyy-MM-dd HH:mm"

  • Add

date.Add(option)

对象增加值,参数为对象格式 option.interval:y-年 q-季 M-月 w-周 d-天 h-时 m-分 s-秒 无-时间戳

API - Vue

  • loadingStart

this.loadingStart([fn])

开始loading,并执行回调函数(如果存在)

  • loadingStop

this.loadingStop([fn])

结束loading,并执行回调函数(如果存在)

  • $msg

this.$msg(option)

基于elementUI,简化message

  • $msgSuccess

this.$msg(option)

基于elementUI,简化message.success

  • $msgError

this.$msg(option)

基于elementUI,简化message.error

  • postMessage

this.postMessage(data,target)

传递消息

//example:
var dataJson = {    
    type: 'switchPage',
    className: 'Projects',
    refershFlag: true
}
this.postMessage(dataJson, '*');
//等同于 window.parent.postMessage(dataJson, '*');
  • openNewPage

this.openNewPage(url)

  • 返回随机数,限定长度length
  • 等同于window.open(url, "_blank");
  • log

this.log(object[,object2])

控制台记录

  • has

this.has(object,key)

判断对象中是否存在键

  • objectArray_get_value2_by_key1_value1

this.objectArray_get_value2_by_key1_value1(array, key, value, key2)

从对象数组中,根据K-V找到对象,并根据K2找到V2

  • objectArray_set_value2_by_key1_value1

this.objectArray_set_value2_by_key1_value1(array, key, value, key2, value2)

从对象数组中,根据K-V找到对象,并根据K2设置V2

  • objectPropertyMerge

this.objectPropertyMerge( obj, key, value,flag)

对象属性融合

  • getGVerify

this.getGVerify( )

验证码

//example:
 this.verifyCode = new this.getGVerify("yzm");
 //1.在id为yzm的元素内填充canvas
 //2.返回验证码verifyCode

许可证

MIT