js-util-tool
v1.0.4
Published
npm install js-util-tool
Downloads
6
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 |