1 Star 0 Fork 0

15779735060 / super-toolkit

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

super-toolkit

介绍

一个轻量级的javaScript超级工具库,代码仓库地址:https://gitee.com/yanxiufei/super-toolkit

浏览器支持

Chrome Firefox Safari Opera Edge IE
Latest ✔ Latest ✔ Latest ✔ Latest ✔ Latest ✔ 8 ✔

安装教程

// npm引入
npm i super-toolkit -S
// 标签引入
<script src="lib/super-toolkit.min.js"></script>

开始使用

  1. 默认导入:import superToolkit from 'super-toolkit'
  2. 按需导入:import {xxxx} from 'super-toolkit'

使用说明

unique
/**
  * @desc:数组去重
  * @param:{Array} arr
  * @param:{?String} key
  * @return:{Array}
 */
minSort or maxSort
/**
  * @desc:数组升序 or 降序排序(传入对象数组需要传key)
  * @param:{Array<Record<string, any>> | Array<string|number>} arr
  * @param:{String} key
  * @return:{Array}
 */
deepClone
/**
  * @desc:深克隆
  * @param:{Any} value
  * @return:{Any}
 */
isEmpty
/**
  * @desc:判断是否为空字符串、null、undefined、空对象、空数组
  * @param:{String | Number | Array | Object | null | undefined} value
  * @return:{Boolean}
 */
group
/**
  * @desc:数据分组筛选
  * @param:{Array} array
  * @param:{Array} keys
  * @return:{Array}
 */
isSame
/**
  * @desc:判断两个参数的数据是否一样
  * @param:{any} sourceData
  * @param:{any} compareData
  * @return:{Boolean}
 */
getDataType
/**
  * @desc:返回参数的数据类型
  * @param:{any} data
  * @return:{String}
 */
getElementContent
/**
  * @desc:获取指定节点内容
  * @param:{String} msg
  * @param:{String} el
  * @return:{String} content
 */
onDebounce or onThrottle
/**
  * @desc:防抖 or 节流函数
  * @param:{Function} fn
  * @param:{Number} wait
 */
getApplication
/**
  * @desc:根据url获取指定的application类型
  * @param:{String} url
  * @return:{String | Null}
 */
fileToBase64
/**
  * @desc:file转base64
  * @param:{File | Blob} file
  * @return:{Promise<String>}
 */
base64ToBlob
/**
  * @desc:base64转blob
  * @param:{String} base64
  * @param:{String} application
  * @return:{Blob}
 */
blobToFile
/**
  * @desc:blob转file
  * @param:{Blob} blob
  * @param:{String} fileName
  * @param:{String} application
  * @return:{File}
 */
base64ToFile
/**
  * @desc:base64转File
  * @param:{String} base64
  * @param:{String} fileName
  * @param:{String} application
  * @return:{File}
 */
getLocalStorage
/**
  * @desc:获取浏览器localStorage的数据
  * @param:{String} key
  * @return:{Any | Null}
 */
setLocalStorage
/**
  * @desc:设置浏览器localStorage的数据
  * @param:{String} key
  * @param:{Any} value
  * @return:{void}
 */
getRandomColor
/**
  * @desc:随机生成16进制颜色
  * @return:{String}
 */
getRandomString
/**
  * @desc:随机生成指定长度的字符串
  * @param:{Number} size
  * @return:{String}
 */
validate
/**
  * @desc:验证正负整数、身份证、手机号、邮箱地址、金额、邮编等
  * @param:{String} value
  * @return:{Boolean}
 */
getDate
/**
  * @desc:获取指定格式的时间
  * @param:{Date | String} date
  * @param:{'YYYY/MM/DD HH:MM:SS' | 'YYYY-MM-DD HH:MM:SS' | 'YYYY/MM/DD' | 'YYYY-MM-DD' | 'MM/DD' | 'MM-DD' | 'MM' | 'DD'} format
  * @param:{Number} day
  * @return:{String}
 */
getMonday
/**
  * @desc:获取单月月指定周数的开始时间与结束时间
  * @param:{"s" | "e"} type
  * @param:{Number} start
  * @return:{String}
 */
getWeek
/**
  * @desc:获取时间对应的星期几
  * @param:{Date | String} date
  * @return:{String}
 */
MIT License Copyright (c) 2023 15779735060 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一个轻量级的javaScript超级工具库 展开 收起
JavaScript 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/yanxiufei/super-toolkit.git
git@gitee.com:yanxiufei/super-toolkit.git
yanxiufei
super-toolkit
super-toolkit
master

搜索帮助