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 🙏

© 2025 – Pkg Stats / Ryan Hefner

kcool

v0.0.1

Published

A JavaScript Library.

Readme

kcool.js

====== tools. 工具

global_variable() 打印全局变量

trim(str) 删除左右两端的空格

ltrim(str) 删除左边的空格

rtrim (str) 删除右边的空格

route_3(str) 获得上上级文件目录

parseDate(date) 日期字符串格转日期

parseJSON(jsonString) Json字符串转对象

getUid() 取不重复唯一值

random(n1, n2) 获取指定范围的随机数

s2ms(str) 秒转换为毫秒

ms2s(str) 毫秒转换为秒

num2number(num, n) 数字转换为编号

num2gb(n) 数字转化为中文

getXY(ev) 获取鼠标位置

drag(obj, obj2) 绑定拖动事件

sliderX(obj, x1, x2, overEvent, upEvent) 绑定横向滚动事件

sliderY(obj, y1, y2, overEvent, upEvent) 绑定竖向滚动事件

each(obj, func, context) 遍历

getPlayer(url, width, height, param) 播放器生成代码

getFlash(url, width, height, param) Flash生成代码

docReady(func) Dom加载

====== extend. 对象继承或属性合并

inspect(originalObject) 一个静态方法, 传入一个对象, 返回对象的字符串表示

keys(originalObject) 一个静态方法, 传入一个对象, 返回该对象中所有的属性, 构成数组返回

values(originalObject) 一个静态方法, 传入一个对象, 返回该对象中所有属性所对应的值, 构成数组返回

clone(originalObject) 一个静态方法, 传入一个对象, 克隆一个新对象并返回

====== assembly. 组件

setOpacity(node,level) 设置透明度setOpacity,node 类名 level 透明度

hide(elem) 隐藏或显示元素

show(elem) 隐藏或显示元素

toggle(elem) 隐藏或显示元素

loadimages() 图像预加载

====== judge. 判断

isArray(v) 是否为数组

isfunction(v) 是否为函数体

isNumber(v) 是否为数字

isDate(v) 是否为日期

isElement(v) 是否为Dom元素节点

====== acquire. 获得值

getId(id) 取id元素

getName(name) 取name元素集合

getTag(tag, root) 取tag元素集合

getAll(attrName, attrValue, tag, root) 按属性名(是否包含)、值、范围取元素集合

getBody 取body元素

getClass(attrValue, tag, root) 取Class属性元素集合

getWinWidth 取浏览器窗体宽度

getWinHeight 取浏览器窗体高度

getStyle(elem, name) 取元素样式

getPosition() 获取元素屏幕坐标值

xmlhttp() 获取XMLHttp对象

get(url, callBack) Get数据

post(url, arg, callBack) Post数据

====== browser. 浏览器

isOpera

isChrome

isWebKit

isSafari

isIe

isIe6

isFirefox

isQuirks

getVersion

========= dom. Dom操作

(-------------------未完待续----------------------)