@mrtujiawei/utils
Advanced tools
Comparing version 1.1.29 to 1.1.30
{ | ||
"name": "@mrtujiawei/utils", | ||
"version": "1.1.29", | ||
"version": "1.1.30", | ||
"description": "把自己写的工具函数打包发布到npm上", | ||
@@ -13,3 +13,4 @@ "types": "types/index.d.ts", | ||
"build": "webpack", | ||
"pub": "npm run build && npm publish --access public && echo \"publish success\" && sleep 1 && rm dist types -rf", | ||
"pub": "npm run build && npm publish --access public", | ||
"clear": "&& echo \"publish success\" && sleep 1 && rm dist types -rf", | ||
"test": "jest", | ||
@@ -16,0 +17,0 @@ "test:coverage": "jest --coverage" |
@@ -0,2 +1,8 @@ | ||
/** | ||
* 0-1背包问题 | ||
* @filename: backpack.ts | ||
* @author: Mr Prince | ||
* @date: 2021-06-14 15:54:51 | ||
*/ | ||
declare function backpack(values: number[], weights: number[], capacity: number): number; | ||
export default backpack; |
/// <reference types="node" /> | ||
/** | ||
* 布隆过滤器 | ||
* 使用条件: | ||
* 1. 经常需要判断某个元素是否存在 | ||
* 2. 数据量巨大,希望使用较少空间 | ||
* 3. 允许有一定的误判率 | ||
* | ||
* 没有继续往下讲,有机会补完吧 | ||
* @filename: BloomFilter.ts | ||
* @author: Mr Prince | ||
* @date: 2021-06-13 20:06:15 | ||
*/ | ||
declare class BloomFilter<T> { | ||
@@ -13,7 +25,26 @@ static IllegalArgumentException: { | ||
}; | ||
/** | ||
* 二进制向量长度 | ||
*/ | ||
private readonly bitSize; | ||
/** | ||
* 二进制向量 | ||
*/ | ||
private readonly bits; | ||
/** | ||
* 哈希函数个数 | ||
*/ | ||
private readonly hashSize; | ||
/** | ||
* @param misjudgmentRate 取值范围 (0, 1) | ||
*/ | ||
constructor(size: number, misjudgmentRate: number); | ||
/** | ||
* TODO 最后还是没写完 | ||
* 添加元素 | ||
*/ | ||
put(value: T): void; | ||
/** | ||
* 判断是否包含 | ||
*/ | ||
contains(value: T): boolean; | ||
@@ -20,0 +51,0 @@ get getMisjudgmentRate(): number; |
@@ -0,2 +1,8 @@ | ||
/** | ||
* 汉诺塔 | ||
* @filename: Hanoi.js | ||
* @author: Mr Prince | ||
* @date: 2021-06-10 20:08:06 | ||
*/ | ||
declare function Hanoi(number: number, plant1: string, plant2: string, plant3: string): void; | ||
export default Hanoi; |
@@ -0,1 +1,7 @@ | ||
/** | ||
* 最长公共子序列 | ||
* @filename: longestCommonSubsequence.ts | ||
* @author: Mr Prince | ||
* @date: 2021-06-13 14:07:06 | ||
*/ | ||
declare function longestCommonSubsequence<T>(sequence1: T[], sequence2: T[]): number; |
@@ -0,2 +1,13 @@ | ||
/** | ||
* 最大子序列和 | ||
* @filename: maxSubArraySum.ts | ||
* @author: Mr Prince | ||
* @date: 2021-06-12 15:17:49 | ||
*/ | ||
declare function maxSubArraySum(arr: number[]): number; | ||
export default maxSubArraySum; | ||
/** | ||
* 动态规划版 | ||
* @param {number[]} nums | ||
* @return {number} | ||
*/ |
@@ -0,1 +1,7 @@ | ||
/** | ||
* n 皇后问题 研究的是如何将 n 个皇后放置在 n×n 的棋盘上,并且使皇后彼此之间不能相互攻击。 | ||
* 给你一个整数 n ,返回 n 皇后问题 不同的解决方案的数量。 | ||
* 1 <= n <= 9 | ||
* 皇后彼此不能相互攻击,也就是说:任何两个皇后都不能处于同一条横行、纵行或斜线上。 | ||
*/ | ||
declare var totalNQueens: (n: number) => number; |
/// <reference types="node" /> | ||
/** | ||
* 跳表 | ||
* @filename: SkipList.ts | ||
* @author: Mr Prince | ||
* @date: 2021-06-16 21:18:13 | ||
*/ | ||
declare class SkipList<K, V> { | ||
private static readonly MAX_LEVEL; | ||
/** | ||
* 概率 | ||
*/ | ||
private static readonly RATE; | ||
@@ -15,4 +24,13 @@ static KeyTypeError: { | ||
}; | ||
/** | ||
* 节点数 | ||
*/ | ||
private _size; | ||
/** | ||
* 首节点有效层数 | ||
*/ | ||
private level; | ||
/** | ||
* 不存放任何k-v | ||
*/ | ||
private first; | ||
@@ -24,2 +42,8 @@ constructor(); | ||
isEmpty(): boolean; | ||
/** | ||
* 添加的时候随机多少层 | ||
* 先找到位置插入 | ||
* 完成插入后随机添加层 | ||
* 完成所有指向 | ||
*/ | ||
put(key: K, value: V): V; | ||
@@ -26,0 +50,0 @@ get(key: K): V | null; |
/// <reference types="node" /> | ||
/** | ||
* 并查集 | ||
* quick union | ||
* @filename: UnionFind.ts | ||
* @author: Mr Prince | ||
* @date: 2021-06-06 18:38:53 | ||
*/ | ||
declare class UnionFind { | ||
@@ -16,6 +23,18 @@ static IllegaleArgumentException: { | ||
private rangeCheck; | ||
/** | ||
* 查找集合的根节点 | ||
*/ | ||
find(value: number): number; | ||
/** | ||
* 合并所属集合 | ||
*/ | ||
union(value1: number, value2: number): void; | ||
/** | ||
* quick find union | ||
*/ | ||
/** | ||
* 是否属于同一集合 | ||
*/ | ||
isSame(value1: number, value2: number): boolean; | ||
} | ||
export default UnionFind; |
@@ -0,2 +1,8 @@ | ||
/** | ||
* 桶排序 | ||
* @filename: countingSort.ts | ||
* @author: Mr Prince | ||
* @date: 2021-06-01 20:19:48 | ||
*/ | ||
declare function countingSort(arr: number[]): number[]; | ||
export default countingSort; |
@@ -0,2 +1,8 @@ | ||
/** | ||
* 插入排序最简版 | ||
* @filename: insertSort.ts | ||
* @author: Mr Prince | ||
* @date: 2021-05-31 21:06:15 | ||
*/ | ||
declare function insertSort(arr: number[]): number[]; | ||
export default insertSort; |
@@ -0,2 +1,8 @@ | ||
/** | ||
* 归并排序 | ||
* @filename: MergeSort.js | ||
* @author: Mr Prince | ||
* @date: 2021-05-28 21:10:48 | ||
*/ | ||
declare function mergeSort(arr: number[]): number[]; | ||
export default mergeSort; |
@@ -0,2 +1,8 @@ | ||
/** | ||
* 快排 | ||
* @filename: quickSort.js | ||
* @author: Mr Prince | ||
* @date: 2021-05-29 21:10:48 | ||
*/ | ||
declare function quickSort(arr: number[]): number[]; | ||
export default quickSort; |
@@ -0,2 +1,8 @@ | ||
/** | ||
* 基数排序,没写完 | ||
* @filename: radixSort.js | ||
* @author: Mr Prince | ||
* @date: 2021-06-03 19:43:42 | ||
*/ | ||
declare function radixSort(arr: number[]): number[]; | ||
export default radixSort; |
@@ -0,2 +1,8 @@ | ||
/** | ||
* 希尔排序 | ||
* @filename: shellSort.ts | ||
* @author: Mr Prince | ||
* @date: 2021-05-31 12:10:54 | ||
*/ | ||
declare function shellSort(arr: number[]): number[]; | ||
export default shellSort; |
@@ -0,22 +1,77 @@ | ||
/** | ||
* 消息内容: 倒计时时间 或 结束内容 | ||
*/ | ||
declare type Message = string | number; | ||
interface Content { | ||
/** | ||
* 消息内容 | ||
*/ | ||
message: Message; | ||
/** | ||
* 是否完成 | ||
*/ | ||
done: boolean; | ||
} | ||
/** | ||
* 启动配置 | ||
*/ | ||
interface StartConfig { | ||
/** | ||
* 开始值,默认60 | ||
*/ | ||
start: number; | ||
/** | ||
* 结束值,默认(0) | ||
*/ | ||
end: number; | ||
/** | ||
* 间隔时间(s),默认1 | ||
*/ | ||
timeout: number; | ||
} | ||
/** | ||
* 回调函数类型 | ||
*/ | ||
declare type Callback = (content: Content) => void; | ||
/** | ||
* 倒计时类 | ||
*/ | ||
declare class CountDown { | ||
private message; | ||
private callbacks; | ||
/** | ||
* 定义结束消息是什么 | ||
*/ | ||
constructor(message: string); | ||
/** | ||
* 开始倒计时,异步执行,await 有效 | ||
* | ||
* @param config - 启动配置 | ||
*/ | ||
start(config?: StartConfig): Promise<void>; | ||
/** | ||
* 发布每次变化 | ||
* | ||
* @param message - 倒计时时间 或 构造函数传入的内容 | ||
*/ | ||
private publish; | ||
/** | ||
* 添加订阅 | ||
* | ||
* @param callback - 订阅函数 | ||
* @returns - 返回添加的函数 | ||
*/ | ||
subscribe(callback: Callback): Callback; | ||
/** | ||
* 取消订阅 | ||
* | ||
* @param callback - subscribe 的函数 | ||
* @returns - 是否移除, false 说明回调函数不存在 | ||
*/ | ||
unsubscribe(callback: Callback): boolean; | ||
/** | ||
* 清空所有订阅函数 | ||
*/ | ||
clear(): void; | ||
} | ||
export default CountDown; |
declare class DateTimeTool { | ||
/** | ||
* 格式化时间 | ||
*/ | ||
static timeFormat(date: Date, delimiter?: string): string; | ||
/** | ||
* 格式化日期 | ||
*/ | ||
static dateFormat(date: Date, delimiter?: string): string; | ||
/** | ||
* 格式化日期时间 | ||
*/ | ||
static dateTimeFormat(date: Date, dateDelimiter?: string, timeDelimiter?: string): string; | ||
/** | ||
* 获取n天以前时间和当前日期时间 | ||
*/ | ||
static getNthDayBefore(n: number): Date[]; | ||
/** | ||
* 获取n小时之前到当前时间 | ||
*/ | ||
static getNthHourBefore(n: number): Date[]; | ||
/** | ||
* 获取n月以前时间到当前月时间 | ||
*/ | ||
static getNthMonthBefore(n?: number): Date[]; | ||
/** | ||
* 设置到当前天的开始 | ||
*/ | ||
static toDayBegin(date: Date): void; | ||
} | ||
export default DateTimeTool; |
/// <reference types="node" /> | ||
/** | ||
* 大顶堆 | ||
* compare返回值取个相反数就是小顶堆 | ||
* @filename: Heap.ts | ||
* @author: Mr Prince | ||
* @date: 2021-07-13 09:02:21 | ||
*/ | ||
declare class Heap<T> { | ||
@@ -25,12 +32,41 @@ private heap; | ||
}; | ||
/** | ||
* @param compare - 比较函数 | ||
* @param arr - 初始数据,需要注意不要再继续使用这个数组了 | ||
*/ | ||
constructor(compare: (a: T, b: T) => number, arr?: T[]); | ||
/** | ||
* 根据初始数据建堆 | ||
*/ | ||
private buildHeap; | ||
/** | ||
* 下沉操作调整堆 | ||
* 类似数组移位,把要移动的数据移出来,找到第一个不满足要求的数据的位置,填入 | ||
*/ | ||
private shiftDown; | ||
/** | ||
* 上浮操作调整堆 | ||
*/ | ||
private shiftUp; | ||
/** | ||
* 获取堆大小 | ||
*/ | ||
get size(): number; | ||
/** | ||
* 是否为空 | ||
*/ | ||
isEmpty(): boolean; | ||
/** | ||
* 获取顶点值 | ||
*/ | ||
peak(): T; | ||
/** | ||
* 插入节点 | ||
*/ | ||
insert(value: T): void; | ||
/** | ||
* 移除顶点 | ||
*/ | ||
remove(): T; | ||
} | ||
export default Heap; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* 下标错误 | ||
*/ | ||
declare class InvalidIndexError extends Error { | ||
@@ -10,32 +13,125 @@ constructor(message?: string); | ||
constructor(); | ||
/** | ||
* 检查下标,如果不对就报个错 | ||
* | ||
* @param index - 下标 | ||
*/ | ||
private checkIndex; | ||
/** | ||
* 清空 | ||
*/ | ||
clear(): void; | ||
/** | ||
* 连接两个链表,不是纯函数 | ||
*/ | ||
concat(linkList: LinkList<T>): LinkList<T>; | ||
/** | ||
* 是否包含某个值 | ||
*/ | ||
contains(value: T): boolean; | ||
/** | ||
* 过滤出所有的值 | ||
*/ | ||
filter(fn: (value: T, index: number, linkList: LinkList<T>) => boolean): LinkList<T>; | ||
/** | ||
* 查找第一个满足要求的元素, 找不到就是undefined | ||
*/ | ||
find(fn: (value: T, index: number, linkList: LinkList<T>) => boolean): T | undefined; | ||
/** | ||
* 查找第一个满足要求的元素下标 | ||
*/ | ||
findIndex(fn: (value: T, index: number, linkList: LinkList<T>) => boolean): number; | ||
/** | ||
* 简单循环 | ||
*/ | ||
forEach(fn: (value: T, index: number, linkList: LinkList<T>) => void): void; | ||
/** | ||
* 获取指定下标的值 | ||
*/ | ||
get(index: number): T; | ||
/** | ||
* 判断是否包含某一个值 | ||
*/ | ||
includes(value: T): boolean; | ||
/** | ||
* 查找指定值的下标 | ||
*/ | ||
indexOf(value: T): number; | ||
/** | ||
* 判断是否为空 | ||
*/ | ||
isEmpty(): boolean; | ||
/** | ||
* 根据指定分隔符连接字符串 | ||
*/ | ||
join(delimiter?: string, transfer?: (value: T, index: number, linkList: LinkList<T>) => string): string; | ||
/** | ||
* 指定值的最大下标 | ||
*/ | ||
lastIndexOf(value: T): number; | ||
/** | ||
* 指定条件的映射 | ||
* 返回一个新 | ||
*/ | ||
map(fn: (value: T, index: number, linkList: LinkList<T>) => T): LinkList<T>; | ||
/** | ||
* 去掉最后一个 | ||
*/ | ||
pop(): T | undefined; | ||
/** | ||
* 向尾部添加 | ||
*/ | ||
push(value: T): void; | ||
/** | ||
* 缩减 | ||
*/ | ||
reduce(fn: (prev: any, currentValue: T, index: number) => any, initialValue?: any): any; | ||
/** | ||
* 反向缩减 | ||
*/ | ||
reduceRight(fn: (prev: any, currentValue: T, index: number) => any, initialValue?: any): any; | ||
/** | ||
* 移除指定下标的值 | ||
*/ | ||
remove(index: number): T | undefined; | ||
/** | ||
* 反转, 应该要改变原来的 | ||
* 这里不是简单改个头指针就行了 | ||
* 需要交换每个节点的前后指针 | ||
*/ | ||
reverse(): LinkList<T>; | ||
/** | ||
* 设置指定位置的值 | ||
*/ | ||
set(index: number, value: T): void; | ||
/** | ||
* 移除第一个 | ||
*/ | ||
shift(): T | undefined; | ||
/** | ||
* 获取的长度 | ||
*/ | ||
size(): number; | ||
/** | ||
* 获取其中的一段 | ||
*/ | ||
slice(start?: number, end?: number): LinkList<T>; | ||
/** | ||
* 遍历其中的一部分, 和findIndex逻辑几乎一样 | ||
*/ | ||
some(fn: (value: T, index: number) => boolean): boolean; | ||
/** | ||
* 排序,选择排序,毕竟是自己写的工具,要求不能太高 | ||
*/ | ||
sort(fn: (item1: T, item2: T) => number): this; | ||
toString(): string; | ||
toArray(): T[]; | ||
/** | ||
* 向头部添加 | ||
*/ | ||
unshift(value: T): void; | ||
/** | ||
* 返回一个迭代器 | ||
* 为了能够for..of循环 | ||
*/ | ||
[Symbol.iterator](): { | ||
@@ -42,0 +138,0 @@ next(): { |
/// <reference types="node" /> | ||
declare class Lock { | ||
/** | ||
* size大小不合理 | ||
*/ | ||
static readonly InvalidSizeError: { | ||
@@ -13,10 +16,28 @@ new (message?: string): { | ||
}; | ||
/** | ||
* 放等待锁的回调函数 | ||
*/ | ||
private queue; | ||
/** | ||
* 当前被占用的个数 | ||
*/ | ||
private size; | ||
/** | ||
* 最大可以占用的个数 | ||
*/ | ||
private maxSize; | ||
constructor(size?: number); | ||
/** | ||
* 设置能够同时获取多少次权限 | ||
*/ | ||
private setSize; | ||
/** | ||
* 获取锁 | ||
*/ | ||
lock(): Promise<void>; | ||
/** | ||
* 释放锁 | ||
*/ | ||
unLock(): void; | ||
} | ||
export default Lock; |
@@ -14,2 +14,5 @@ export declare enum LOG_LEVEL { | ||
static LOG_LEVEL: typeof LOG_LEVEL; | ||
/** | ||
* 大于等于当前等级的才会打印 | ||
*/ | ||
private level; | ||
@@ -19,5 +22,22 @@ private listenHandle; | ||
private constructor(); | ||
/** | ||
* 格式化日志信息 | ||
*/ | ||
private formatMessage; | ||
/** | ||
* 处理参数 | ||
* 1. 如果是字符串,直接返回 | ||
* 2. 如果是undefined 或者 null,改成字符串 | ||
* 3. 如果是Error,打印message 和 stack | ||
* 4. 如果是Date类型,打印时间戳 | ||
* 5. 如果是对象,JSON.stringify | ||
*/ | ||
private getParameters; | ||
/** | ||
* 内部发布消息,给订阅的函数 | ||
*/ | ||
private publish; | ||
/** | ||
* 单例工厂,获取logger实例 | ||
*/ | ||
static getLogger(): Logger; | ||
@@ -24,0 +44,0 @@ setLevel(level: LOG_LEVEL): void; |
@@ -0,1 +1,7 @@ | ||
/** | ||
* 前端分页 | ||
* 数据逻辑处理 | ||
* 主要是我不知道 | ||
* 怎么把jsx或者dom操作等编译到这里面去 | ||
*/ | ||
interface TableData { | ||
@@ -15,3 +21,13 @@ pageNum: number; | ||
setOrder(key?: string): void; | ||
/** | ||
* 必须是能够排序的 | ||
* 如果不能够排序,就另加一个字段来排序 | ||
*/ | ||
sort(key: string, order?: 'asc' | 'desc'): void; | ||
/** | ||
* 跳转到指定页 | ||
* 不传参默认跳转当前页 | ||
* 不返回任何数据 | ||
* 需要监听subscribe | ||
*/ | ||
to(pageNum?: number): any[]; | ||
@@ -18,0 +34,0 @@ setPageSize(pageSize: number): void; |
@@ -0,1 +1,7 @@ | ||
/** | ||
* 优先队列,默认最大队列 | ||
* @filename: PriorityQueue.ts | ||
* @author: Mr Prince | ||
* @date: 2021-07-13 16:57:28 | ||
*/ | ||
declare class PriorityQueue<T> { | ||
@@ -2,0 +8,0 @@ private queue; |
/// <reference types="node" /> | ||
/** | ||
* 队列 | ||
* @filename: Queue.js | ||
* @author: Mr Prince | ||
* @date: 2021-05-07 15:30:21 | ||
*/ | ||
declare class Queue<T> { | ||
/** | ||
* 队列为空时仍获取元素 | ||
*/ | ||
static readonly QueueEmptyError: { | ||
@@ -10,3 +19,5 @@ new (message?: string): { | ||
captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; | ||
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; | ||
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; /** | ||
* 入队 | ||
*/ | ||
stackTraceLimit: number; | ||
@@ -17,5 +28,11 @@ }; | ||
isEmpty(): boolean; | ||
/** | ||
* 入队 | ||
*/ | ||
enqueue(...values: T[]): void; | ||
/** | ||
* 出队 | ||
*/ | ||
dequeue(): T; | ||
} | ||
export default Queue; |
@@ -0,6 +1,18 @@ | ||
/** | ||
* 职责链模式 | ||
* @filename: ResponsibilityChain.js | ||
* @author: Mr Prince | ||
* @date: 2020-09-09 20:19:27 | ||
*/ | ||
declare class ResponsibilityChain { | ||
chain: Function[]; | ||
/** | ||
* 验证一些事情,如果返回的值判断为true就不通过 | ||
*/ | ||
add(callback: Function): void; | ||
/** | ||
* 开始校验 | ||
*/ | ||
doAction(...args: any[]): any; | ||
} | ||
export default ResponsibilityChain; |
/// <reference types="node" /> | ||
declare class Stack<T> { | ||
/** | ||
* 栈为空时仍获取元素 | ||
*/ | ||
static readonly StackEmptyError: { | ||
@@ -14,8 +17,23 @@ new (message?: string): { | ||
private stack; | ||
/** | ||
* 获取当前栈的大小 | ||
*/ | ||
get size(): number; | ||
/** | ||
* 判断栈是否为空 | ||
*/ | ||
isEmpty(): boolean; | ||
/** | ||
* 入栈 | ||
*/ | ||
push(...values: T[]): void; | ||
/** | ||
* 出栈 | ||
*/ | ||
pop(): T; | ||
/** | ||
* 返回栈顶元素 | ||
*/ | ||
peak(): T; | ||
} | ||
export default Stack; |
import Lock from './Lock'; | ||
interface Options { | ||
/** | ||
* 任务超时时间 | ||
*/ | ||
timeout?: number; | ||
/** | ||
* 实际实行任务的函数 | ||
*/ | ||
handler?: Function; | ||
} | ||
/** | ||
* 任务队列封装, 同一时间只能处理一件事 | ||
* @filename: TaskQueue.js | ||
* @author: Mr Prince | ||
* @date: 2020-09-02 17:12:29 | ||
*/ | ||
declare class TaskQueue { | ||
@@ -11,6 +23,17 @@ access: Lock; | ||
constructor(options: Options); | ||
/** | ||
* 修改全局延时和回调函数 | ||
*/ | ||
setOptions(options: Options): void; | ||
/** | ||
* 执行回调 | ||
* 需传入handler对应参数 | ||
*/ | ||
push(...args: any[]): Promise<any>; | ||
/** | ||
* 获取执行权限 | ||
* 超过一定时间后自动结束 | ||
*/ | ||
private getAccess; | ||
} | ||
export default TaskQueue; |
@@ -15,11 +15,40 @@ export declare const toString: (obj: any) => string; | ||
} | ||
/** | ||
* 延迟一段时间(秒) | ||
*/ | ||
export declare function sleep(timeout?: number): Promise<void>; | ||
/** | ||
* 遍历对象所有属性 | ||
* 移除左右两边空格 | ||
*/ | ||
export declare function trim<T>(data: T): T; | ||
/** | ||
* 不足位补0 | ||
*/ | ||
export declare function addZero(num: string | number, length?: number): string; | ||
/** | ||
* 处理url请求参数 | ||
* 需要手动加? | ||
*/ | ||
export declare function objectToUrlParams(params: object): string; | ||
/** | ||
* 请求参数转对象 | ||
*/ | ||
export declare function urlParamsToObject(urlParams: string): object; | ||
/** | ||
* 判断是不是一个没有任何属性的对象 | ||
*/ | ||
export declare function isPlainObject(obj: any): boolean; | ||
/** | ||
* 防抖 | ||
*/ | ||
export declare function debounce(callback: Function, timeout: number): Function; | ||
/** | ||
* 判断是否是promise | ||
*/ | ||
export declare function isPromise(val: any): boolean; | ||
export declare function identify(val: any): any; | ||
/** | ||
* 重试函数 | ||
*/ | ||
export declare function retry(callback: Function, times?: number): Function; | ||
@@ -30,7 +59,22 @@ declare type Options = { | ||
}; | ||
/** | ||
* 节流 | ||
*/ | ||
export declare function throttle(callback: Function, options?: Options): (...params: any[]) => any; | ||
/** | ||
* 延迟节流 | ||
*/ | ||
export declare function trailing(callback: Function, timeout: number): (...params: any[]) => any; | ||
/** | ||
* 是否是数字 | ||
*/ | ||
export declare function isInteger(number: any): boolean; | ||
/** | ||
* 隐藏部分手机号 | ||
*/ | ||
export declare function hiddenMobile(mobile: string): string; | ||
/** | ||
* 反转数组中的某一段(不包括end) | ||
*/ | ||
export declare function reverseRange(arr: any[], start: number, end: number): void; | ||
export {}; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
92952
980
0