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

roo-tool

v1.0.2

Published

This is a front-end scaffold commonly used tool library, integrates the Cookie, with indexedDB and custom event operations

Downloads

7

Readme

roo-tool

袋鼠云前端工具函数

Install

npm install roo-tool

使用

<script src="/path/to/roo-tool.js">
//或
</script><script src="/path/to/roo-tool.min.js"></script>

Package Managers

JavaScript RooTool supports npm and yarn under the name roo-tool. Module Loaders

Module Loaders

JavaScript RooTool can also be loaded as an AMD, CommonJS or ES6 module.

集成模块

集成npm第三方依赖包,包含其所有功能。

js-cookie //最新版本
urijs   //最新版本

Basic Usage

cosnt {LocalDb,URI,Cookie,Tool} from 'roo-tool';
localDb.set('dux','nblt');
localDb.get('dux');
localDb.clear();

Cookies.set('name', 'value', { path: '' });
Cookies.remove('name'); // fail!
Cookies.remove('name', { path: '' }); // removed!

// URI基本操作api
var url = new URI();
// return http://smoothprogramming.com/tutorials/get-set-query-string-values-from-url-using-uri-js
// This is equivalent to window.location.href command in js.

url = new URI("http://www.smoothprogramming.com:80/tutorials/get-set-query-string-values-from-url-using-uri-js.html");
// Sets URL to http://www.smoothprogramming.com:80/tutorials/get-set-query-string-values-from-url-using-uri-js.html

url;
// return "http://www.smoothprogramming.com:80/tutorials/get-set-query-string-values-from-url-using-uri-js.html"

url.protocol());
// return "http"

url.origin();
// return "http://www.smoothprogramming.com:80"

url.hostname());
// return "www.smoothprogramming.com"

url.host());
// return "www.smoothprogramming.com:80"

url.port());
// return "80"

url.path());
// return "/tutorials/get-set-query-string-values-from-url-using-uri-js.html"

url.directory());
// return "/tutorials"

url.filename());
// return "get-set-query-string-values-from-url-using-uri-js.html"

更多URI及Cookie的信息请查看

Cookie操作相关api: https://www.npmjs.com/package/js-cookie

URI操作相关apI: https://www.npmjs.com/package/urijs


localDb.js相关API

方法|说明|参数| 返回值 --| -- | -- | -- set|按key存贮数据value到localStorage|(key,value),key存贮数据的唯一标识,value 所要存贮的数据|null get|通过key从localStorage获取数据|key(获取数据的可以标识)|null/string/object clear|清空localStorage|-|-


Tool.js相关API

方法|说明|参数| 返回值 --| -- | -- |-- trim| 去除空串 | string |string getDocumentTop | 获取文档高度 | 无 |number getWindowHeight| 可视窗口高度 | 无 |number getScrollHeight| 滚动条滚动高度 | 无 |number getObjectURL| 自定义上传事件获取文件URl方法 | file |string getStrlen| 计算字符串长度(英文占1个字符,中文汉字占2个字符) | string |number isRealUrl| 校验Url的有效性 | url |bool isJSONStr| 判断是否是JSON | string |bool isFunction| 判断是否是函数 | function |bool isPhoneNumber| 校验手机号格式 | string |bool toThousands| 分隔数值千分位符 | number |number debounceFunc| 防抖函数 |func,wait,immediate|null ####Changelog

moved to Changelog

如果封装好更加好用的方法函数,欢迎联系补充

[email protected]