Skip to content

Commit

Permalink
Feat: 优化方法,文档。
Browse files Browse the repository at this point in the history
  • Loading branch information
pandaoh committed Aug 23, 2024
1 parent 1fff70a commit df2dbb1
Show file tree
Hide file tree
Showing 171 changed files with 4,246 additions and 1,019 deletions.
9 changes: 9 additions & 0 deletions dist/Array/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* @param key 分组的 key
* @param vKey 值的 key,默认为整个值。
* @returns
* @category Array-数组相关
*/
export declare function data2Obj(sourceData: {
[key: string]: any;
Expand All @@ -20,6 +21,7 @@ export declare function data2Obj(sourceData: {
* @param sourceData 源数据
* @param key 取值的 key
* @returns
* @category Array-数组相关
*/
export declare function data2Arr(sourceData: {
[key: string]: any;
Expand All @@ -33,6 +35,7 @@ export declare function data2Arr(sourceData: {
* @param data 源数据
* @param key 用于转换的 key
* @returns
* @category Array-数组相关
*/
export declare function arrObj2objArr(data: {
[key: string]: any;
Expand All @@ -47,6 +50,7 @@ export declare function arrObj2objArr(data: {
* @param arr 数组
* @param filter 过滤逻辑
* @returns
* @category Array-数组相关
*/
export declare function unique(arr: any[], filter?: any): any[];
/**
Expand All @@ -59,6 +63,7 @@ export declare function unique(arr: any[], filter?: any): any[];
* @param key 排序的字段
* @param isAscend 是否升序
* @returns
* @category Array-数组相关
*/
export declare function sortCallBack(key: string, isAscend?: boolean): any;
/**
Expand All @@ -67,6 +72,7 @@ export declare function sortCallBack(key: string, isAscend?: boolean): any;
* arrayShuffle([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); /// [5, 9, 1, 10, 2, 6, 4, 8, 3, 7]
* @param arr 数组
* @returns
* @category Array-数组相关
*/
export declare function arrayShuffle(arr: any[]): any[];
/**
Expand All @@ -84,6 +90,7 @@ export declare function arrayShuffle(arr: any[]): any[];
* @param type 类型
* @param keys 关键字/集合
* @returns
* @category Array-数组相关
*/
export declare function arraySort(arr: any[], type?: 'desc' | 'asc' | 'ASC' | 'DESC' | boolean, keys?: string | string[]): any[];
/**
Expand All @@ -96,6 +103,7 @@ export declare function arraySort(arr: any[], type?: 'desc' | 'asc' | 'ASC' | 'D
* @param keys 排序的字段/集合
* @param isAscend 是否升序
* @returns
* @category Array-数组相关
*/
export declare function sortBy(keys?: string | string[], isAscend?: boolean): any;
/**
Expand All @@ -107,6 +115,7 @@ export declare function sortBy(keys?: string | string[], isAscend?: boolean): an
* @param arr 数组
* @param n 保留小数位
* @returns
* @category Array-数组相关
*/
export declare function arrayFill(arr: any[], n?: number): number[];
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion dist/Array/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dist/Cookies/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* getCookie('name'); /// 获取 name 对应的 Cookie 值
* @param key Cookie key
* @returns
* @category Storage-存储相关
*/
export declare function getCookie(key: string): any;
/**
Expand All @@ -14,6 +15,7 @@ export declare function getCookie(key: string): any;
* @param value Cookie value
* @param expires Cookie expires
* @returns
* @category Storage-存储相关
*/
export declare function setCookie(key: string, value: any, expires: number): void;
/**
Expand All @@ -22,13 +24,15 @@ export declare function setCookie(key: string, value: any, expires: number): voi
* removeCookie('name'); /// 删除 name 对应的 Cookie
* @param key Cookie key
* @returns
* @category Storage-存储相关
*/
export declare function removeCookie(key: string): void;
/**
* Clear Cookie
* @example
* clearCookies(); /// 删除所有的 Cookie
* @returns
* @category Storage-存储相关
*/
export declare function clearCookies(): void;
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion dist/Cookies/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions dist/Date/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* @param fmt 格式化模板 'yyyy-mm-dd hh:ii:ss'
* @param weeks 星期对应数组 [7, 1, 2, 3, 4, 5, 6]
* @returns
* @category Date-日期相关
*/
export declare function formatDate(date?: any, fmt?: string, weeks?: any[]): any;
/**
Expand All @@ -21,6 +22,7 @@ export declare function formatDate(date?: any, fmt?: string, weeks?: any[]): any
* @param date 时间
* @param calcStrOrArr '1 days' or ['-1 day', '3 month']
* @returns
* @category Date-日期相关
*/
export declare function calcDate(date: string | Date, calcStrOrArr: string | string[]): Date;
/**
Expand All @@ -32,6 +34,7 @@ export declare function calcDate(date: string | Date, calcStrOrArr: string | str
* @param nowDate 近一点的时间,默认当前时间。
* @param type 计算方式,默认计算差距的精确天数、时分秒。
* @returns
* @category Date-日期相关
*/
export declare function getDateDifference(oldDate: string | Date, nowDate?: string | Date, type?: 'all' | 'day' | 'days' | 'hour' | 'hours' | 'minute' | 'minutes' | 'second' | 'seconds' | 'ALL' | 'DAY' | 'DAYS' | 'HOUR' | 'HOURS' | 'MINUTE' | 'MINUTES' | 'SECOND' | 'SECONDS'): number | {
days: number;
Expand All @@ -47,6 +50,7 @@ export declare function getDateDifference(oldDate: string | Date, nowDate?: stri
* @param longAgo 是否显示周月甚至更久
* @param formatter 正常显示时的时间显示格式
* @returns
* @category Date-日期相关
*/
export declare function timeSince(date?: string | Date, longAgo?: boolean, formatter?: string): any;
/**
Expand All @@ -55,6 +59,7 @@ export declare function timeSince(date?: string | Date, longAgo?: boolean, forma
* isWorkDay(new Date()); /// true
* @param date 日期
* @returns
* @category Date-日期相关
*/
export declare function isWeekday(date?: string | Date): boolean;
/**
Expand All @@ -63,6 +68,7 @@ export declare function isWeekday(date?: string | Date): boolean;
* getDayInYear('2023/06/23'); /// 174
* @param date 日期
* @returns
* @category Date-日期相关
*/
export declare function getDayInYear(date?: string | Date): number;
/**
Expand All @@ -77,6 +83,7 @@ export declare function getDayInYear(date?: string | Date): number;
* @param type 类型
* @param date 日期
* @returns
* @category Date-日期相关
*/
export declare function getDateList(n: number, type?: 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second', date?: any): string[];
/**
Expand All @@ -85,6 +92,7 @@ export declare function getDateList(n: number, type?: 'year' | 'month' | 'day' |
* getDateTime(new Date()); /// time stamp
* @param date 日期
* @returns
* @category Date-日期相关
*/
export declare function getDateTime(date?: string | Date): number;
/**
Expand All @@ -96,6 +104,7 @@ export declare function getDateTime(date?: string | Date): number;
* @param dateA 时间 A
* @param dateB 时间 B
* @returns
* @category Date-日期相关
*/
export declare function compareDate(dateA: any, dateB?: any): -1 | 1 | 0;
/**
Expand All @@ -106,6 +115,7 @@ export declare function compareDate(dateA: any, dateB?: any): -1 | 1 | 0;
* @param callback 回调函数
* @param finishCallBack 完成回调函数
* @returns
* @category Date-日期相关
*/
export declare function countdown(seconds: number, callback?: any, finishCallBack?: any): any;
/**
Expand All @@ -116,6 +126,7 @@ export declare function countdown(seconds: number, callback?: any, finishCallBac
* @param duration 时间/秒
* @param returnObj 是否返回对象
* @returns
* @category Date-日期相关
*/
export declare function transferSeconds(duration: number, returnObj?: boolean): string | any;
/**
Expand All @@ -124,6 +135,7 @@ export declare function transferSeconds(duration: number, returnObj?: boolean):
* getMonthDayCount(new Date()); /// 30
* @param date 日期
* @returns
* @category Date-日期相关
*/
export declare function getMonthDayCount(date?: string | Date): number;
/**
Expand All @@ -133,6 +145,7 @@ export declare function getMonthDayCount(date?: string | Date): number;
* getUTCTime(8); /// 中国标准时间-东八区
* @param timezone 时区数字,东八区为 8,西八区为 -8 。
* @returns
* @category Date-日期相关
*/
export declare function getUTCTime(timezone?: number): Date;
/**
Expand All @@ -145,6 +158,7 @@ export declare function getUTCTime(timezone?: number): Date;
* // 如果时区为 UTC
* getTimezone(); // '+0'
* @returns
* @category Date-日期相关
*/
export declare function getTimezone(): string;
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion dist/Date/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit df2dbb1

Please sign in to comment.