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

js-util-tool

v1.0.4

Published

npm install js-util-tool

Downloads

3

Readme

注意

本包基于 lodash 方法封装

安装

npm install js-util-tool

导入

import {isNull} from 'js-util-tool'

方法如下

| 方法名称 | 方法作用 | 参数 | 返回值 | | :------------------------------------- | :------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------- | | isNull(data) | 判空 | data(Any) 需要判断的数据 | true false | | isObject(data) | 判断是否是对象 | data(Any) 需要判断的数据 | true false | | isNumber(data) | 判断是否是数字 | data(Any) 需要判断的数据 | true false | | isArray(data) | 判断是否是数组 | data(Any) 需要判断的数据 | true false | | isEmptyArray(data) | 判断是否是空数组 | data(Any) 需要判断的数据 | true false | | isFunction(data) | 判断是否是方法 | data(Any) 需要判断的数据 | true false | | isString(data) | 判断是否是 string 类型 | data(Any) 需要判断的数据 | true false | | debounce(func,wait,{leading,trailing}) | 防抖 | func(Function) 防抖动的函数,wait(Number) 需要延迟的毫秒数,leading(Boolean) 指定在延迟开始前调用, trailing(Boolean) 指定在延迟结束后调用 | function (Function) | | throttle(func,wait,{leading,trailing}) | 截流 | func(Function) 防抖动的函数,wait(Number) 需要延迟的毫秒数,leading(Boolean) 指定在延迟开始前调用, trailing(Boolean) 指定在延迟结束后调用 | function(Function) | | cloneDeep(data) | 深拷贝 | data(Any) 需要拷贝的数据 | data(Any) 拷贝的新 data | | getUrlParams(url) | 获取 url 上的参数 | url(String) 地址 | Obj(object) url 上的参数 | | copyHtmlText(text) | html 长按复制 | text(String) 需要复制的数据 | text(String) | | encipherNumberInfo(data,type) | 加密数字信息 | data(String) 需要加密的数据 type(string) phone 手机 , idCard 身份证 | text(String) 加密后的数据 eg:173****111 5002311999*****111 | | blobErrorValidate(data) | 验证文件流接口 返回文件是否正确 | data(File | Blob) 文件流数据 | Obj(Object | null) | | setLocalStorage(key,value) | 设置 localStorage | key(String),value(Any) | null | | getLocalStorage(key) | 获取 localStorage 的值 | key(String) | data(Any) | | deleteLocalStorage(key) | 删除 localStorage | key(String) | null | | clearLocalStorage() | 清空 localStorage | null | null | | setSessionStorage(key,value) | 设置 sessionStorage | key(String),value(Any) | null | | getSessionStorage(key) | 获取 sessionStorage 的值 | key(String) | data(Any) | | deleteSessionStorage(key) | 删除 sessionStorage | key(String) | null | | clearSessionStorage() | 清空 sessionStorage | null | null |