st-common-core
Version:
小尾巴前端通用核心库
135 lines (134 loc) • 6.98 kB
TypeScript
import * as _typeConvertUtil from './common/utils/type-convert-util.ts';
export declare const typeConvertUtil: typeof _typeConvertUtil;
export type SimpleType = _typeConvertUtil.SimpleType;
export declare const SimpleTypeConst: {
readonly INT: "int";
readonly FLOAT: "float";
readonly BOOL: "bool";
readonly STRING: "string";
};
export declare const simpleTypeConvert: <T>(data: any, targetType?: _typeConvertUtil.SimpleType) => T;
import * as _noneUtil from './none/utils/none-util.ts';
export declare const noneUtil: typeof _noneUtil;
export declare const isNone: (data: any) => data is (undefined | null);
import * as _strUtil from './str/utils/str-util.ts';
export declare const strUtil: typeof _strUtil;
export declare const isStr: (data: any) => data is string;
export declare const isEmpty: (str: string) => boolean;
export declare const getByteSizeUtf8: (str: string) => number;
import * as _randomStrUtil from './str/utils/random-str-util.ts';
export declare const randomStrUtil: typeof _randomStrUtil;
export declare const LOWER_CASE_LETTERS = "abcdefghijklmnopqrstuvwxyz";
export declare const UPPER_CASE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
export declare const DIGITS = "0123456789";
export declare const RandomStrTypeConst: {
readonly ALL: "ALL";
readonly LOWER_CASE_LETTERS: "LOWER_CASE_LETTERS";
readonly UPPER_CASE_LETTERS: "UPPER_CASE_LETTERS";
readonly ALL_CASE_LETTERS: "ALL_CASE_LETTERS";
readonly DIGITS: "DIGITS";
readonly LOWER_CASE_LETTERS_DIGITS: "LOWER_CASE_LETTERS_DIGITS";
readonly UPPER_CASE_LETTERS_DIGITS: "UPPER_CASE_LETTERS_DIGITS";
};
export type RandomStrType = _randomStrUtil.RandomStrType;
export declare const genRandomStr: (randomStrType: _randomStrUtil.RandomStrType, len: number) => string;
import * as _urlStrUtil from './str/utils/url-str-util.ts';
export declare const urlStrUtil: typeof _urlStrUtil;
export declare const genUrlQueryByObj: (url: string, obj: Record<string, any>) => string;
export declare const genUrlQueryByArrList: (url: string, arrList: Array<[string, any]>) => string;
import * as _jsonStrUtil from './str/utils/json-str-util.ts';
export declare const jsonStrUtil: typeof _jsonStrUtil;
export declare const jsonStringifyObjProps: ({ obj, props, excludeProps, }: {
obj: Record<string, any>;
props?: string[];
excludeProps?: string[];
}) => Record<string, string>;
export declare const jsonParseObjProps: ({ obj, props, excludeProps, }: {
obj: Record<string, any>;
props?: string[];
excludeProps?: string[];
}) => Record<string, any>;
import * as _arrUtil from './arr/utils/arr-util.ts';
export declare const arrUtil: typeof _arrUtil;
import * as _arrConvertUtil from './arr/utils/arr-convert-util.ts';
export declare const arrConvertUtil: typeof _arrConvertUtil;
export declare const arrConvert2Tree: (origin: any[], primaryFieldName: string, parentFieldName: string, isPath?: boolean, pathFieldName?: string) => {
tree: Array<any & {
children: any[];
}>;
map: Record<any, any & {
children: any[];
}>;
};
export declare const arrConvert2Map: (origin: any[], primaryFieldName: string | ((item: any) => string | number | symbol)) => Record<(string | number | symbol), any>;
export declare const flattenTreeArr: (tree: Array<any>, childrenFieldName?: string) => Array<any>;
import * as _arrCopyUtil from './arr/utils/arr-copy-util.ts';
export declare const arrCopyUtil: typeof _arrCopyUtil;
export declare const arrCopyDeep: ({ origin, props, excludeProps, propsMap, targetPropValMap, excludeArrItem, sort, isCopyEmptyArr, isRemoveObjUndefined, isRemoveArrUndefined, }: {
origin: Array<any>;
props?: string[];
excludeProps?: string[];
propsMap?: Record<string, string | string[]>;
targetPropValMap?: Record<string, (origin: Record<string, any>, originPropName: string, targetPropName: string) => any>;
excludeArrItem?: (item: any) => boolean;
sort?: ((a: any, b: any) => number) | null;
isCopyEmptyArr?: boolean;
isRemoveObjUndefined?: boolean;
isRemoveArrUndefined?: boolean;
}) => any[];
import * as _randomNumUtil from './num/utils/random-num-util.ts';
export declare const randomNumUtil: typeof _randomNumUtil;
export declare const randomIntRightOpen_0_n: (n: number) => number;
export declare const randomIntRightOpen_n_m: (n: number, m: number) => number;
export declare const randomInt_0_n: (n: number) => number;
export declare const randomInt_n_m: (n: number, m: number) => number;
export declare const randomFloatRightOpen_0_n: (n: number) => number;
export declare const randomFloatRightOpen_n_m: (n: number, m: number) => number;
import * as _objConvertUtil from './obj/utils/obj-convert-util.ts';
export declare const objConvertUtil: typeof _objConvertUtil;
export declare const objConvert: <T>(origin: Record<string, any>, target: Record<string, any>) => T;
import * as _objCopyUtil from './obj/utils/obj-copy-util.ts';
export declare const objCopyUtil: typeof _objCopyUtil;
export declare const objCopyDeep: ({ origin, props, excludeProps, propsMap, targetPropValMap, excludeArrItem, sort, isCopyEmptyArr, isRemoveObjUndefined, isRemoveArrUndefined, }: {
origin: Record<string, any>;
props?: string[];
excludeProps?: string[];
propsMap?: Record<string, string | string[]>;
targetPropValMap?: Record<string, (origin: Record<string, any>, originPropName: string, targetPropName: string) => any>;
excludeArrItem?: (item: any) => boolean;
sort?: ((a: any, b: any) => number) | null;
isCopyEmptyArr?: boolean;
isRemoveObjUndefined?: boolean;
isRemoveArrUndefined?: boolean;
}) => Record<string, any>;
import * as _timeConvertUtil from './time/utils/time-convert-util.ts';
export declare const timeConvertUtil: typeof _timeConvertUtil;
export declare const TimeUnit: {
readonly millisecond: "millisecond";
readonly second: "second";
readonly minute: "minute";
readonly hour: "hour";
readonly day: "day";
};
export type TimeUnitType = _timeConvertUtil.TimeUnitType;
export declare const timeConvert: (time: number, fromUnit: _timeConvertUtil.TimeUnitType, toUnit?: _timeConvertUtil.TimeUnitType) => number;
import * as _funThrottleUtil from './fun/utils/fun-throttle-util.ts';
export declare const funThrottleUtil: typeof _funThrottleUtil;
export declare const funThrottleByLimit: ({ fun, tag, limit, thisArg, }: {
fun: (...args: any[]) => Promise<any>;
tag?: string;
limit?: number;
thisArg?: any;
}) => (...args: any[]) => Promise<any>;
export declare const funThrottleByTime: ({ fun, interval, thisArg, }: {
fun: (...args: any[]) => Promise<any>;
interval?: number;
thisArg?: any;
}) => (...args: any[]) => Promise<any>;
import * as _pathRegConsts from './reg/consts/path-reg-const.ts';
export declare const pathRegConsts: typeof _pathRegConsts;
export declare const PathRegConst: {
LINK_PATH_REG: RegExp;
ROUTE_PATH_REG: RegExp;
VUE_COMPONENT_PATH_REG: RegExp;
};