export declare namespace NSFuncArrayLike {
type TLoopFunc<T> = (item: T, index: number, arrLike: ArrayLike<T>) => any;
}
export declare function doLoop<T>(arrLike: ArrayLike<T>, loopFunc: NSFuncArrayLike.TLoopFunc<T>): void;
export declare namespace NSFuncNum {
type TResultIsMatchFloatFalseReason = "stringLengthMax" | "notLikeNumber" | "fractionStringLengthMax";
interface IResultIsMatchFloatFalse {
match: false;
reason: TResultIsMatchFloatFalseReason;
}
interface IResultIsMatchFloatTrue {
match: true;
}
type TResultIsMatchFloat = IResultIsMatchFloatFalse | IResultIsMatchFloatTrue;
}
export declare function stringifyNumber(num: number): string;
export declare function intVal(text: any, nanText: string | number): string | number;
// floatVal("0.0250") ==> 0.025
export declare function floatVal(text: any, nanText: string | number): string | number;
// floatNum("0.0250", 2) => 0.03
// floatNum("0.0250", 3) => 0.025
export declare function floatNum(text: any, saveNum: number, nanText: string | number): string | number;
// toFixed("0.0250", 3) => 0.0250
export declare function toFixed(text: any, saveNum: number, nanText: string | number): string | number;
// toChineseIndex(0) => '零'
// toChineseIndex(0, "0") => "0"
// num取值范围是 [0, 14]; 其中 1 -> 10对应一->十; 11->百;12->千; 13 -> 万;14 ->亿
export declare function toChineseIndex(num: 0, zeroStr: string): string
export declare function toChineseIndex(num: number): string;
export declare function isPositiveNumber(numLikeStr: any): boolean;
export declare function isMatchFloat(num: number | string, maxLen?: number, fractionMaxLen?: number, isLimitInt?: boolean): NSFuncNum.TResultIsMatchFloat;
export declare function isConstraintNum(num: any, maxIntPartLen?: number, maxFractionLen?: number): boolean;
/**
* @since 1.3.3
* @param str
* @param whenNull
*/
export declare function toShowString(str: any, whenNull?: string): string;
/**
* @since 1.3.3
* @param str
* @param whenEmpty
*/
export declare function toNotEmptyString(str: any, whenEmpty?: string): string;
export declare function isNumberLike(numStr: any): boolean;
export declare function isIntLike(numStr: any): boolean;
export declare function isPositiveInt(numStr: any): boolean;
export declare function isMatchFloat(num: number | string, maxLen?: number, fractionMaxLen?: number): NSFuncNum.TResultIsMatchFloat;
export declare function getNumInRange(obj: {
num: number;
min: number;
max?: number;
}): number;
export declare function getNumInRange(obj: {
num: number;
min?: number;
max: number;
}): number;
export declare function getNumInRange(obj: number, min: number, max?: number): number;
export declare class NumTransferTool {
defaultNanText: string | number; // 默认非数字时返回值
defaultSaveNum: number; // 默认小数保留位数
constructor(defaultNanText?: string | number);
floatVal(text: string | number, nanText?: string | number): string | number; // 同上面的floatVal。nanText默认为this.deafultNanText
intVal(text: string | number, nanText?: string | number): string | number;// 同上面的intVal。nanText默认为this.deafultNanText
toFixed(text: string | number, saveNum?: number, nanText?: string | number): string | number;// 同上面的toFixed。nanText默认为this.deafultNanText
floatNum(text: string | number, saveNum?: number, nanText?: string | number): string | number;// 同上面的floatNum。nanText默认为this.deafultNanText
}
export declare const numTransferTool: NumTransferTool; // 默认实例; numTransferTool.defaultNanText = "-"
export declare namespace NSFuncOption {
type TOptionPropertyValue = Option | string | number | ArrayLike<any> | Function | null | undefined;
interface Option {
[attr: string]: TOptionPropertyValue;
}
}
export declare function jsonCopy<T>(obj: T): T;
export declare function copyOptionAsArray<T>(optA: ArrayLike<T>): Array<T>;
export declare function copyOptionAsObj<T>(optA: T): T;
export declare function copyOption(optA: string): string;
export declare function copyOption(optA: number): number;
export declare function copyOption(optA: null): null;
export declare function copyOption(optA: undefined): undefined;
export declare function copyOption<T>(optA: ArrayLike<T>): T[];
export declare function copyOption(optA: Function): Function;
export declare function copyOption(optA: NSFuncOption.Option): NSFuncOption.Option;
export declare function mixedOpt<TypeA, TypeB>(optA: TypeA, optB: TypeB): TypeA & TypeB;
export declare function mixedOptAndCopyResult<TypeA, TypeB>(optA: TypeA, optB: TypeB): TypeA & TypeB;
export declare namespace NSFuncRange {
type TValHandle<T> = (item: T, index: number) => number;
interface IBaseRange {
min: number;
max: number;
}
interface IBaseSplitInfo {
min: number;
max: number;
splitNumber: number;
}
interface IExtraSplitInfo {
stepHandle: (step: number) => number;
baseRefer: 'min' | 'max';
}
interface IBaseSplitInfoStep extends IBaseSplitInfo {
step: number;
}
interface IBaseSplitInfoStepTimes extends IBaseSplitInfoStep {
timesBase: number;
}
}
export declare function getRangeOfDataList<T>(list: ArrayLike<T>, valHandle?: NSFuncRange.TValHandle<T>): NSFuncRange.IBaseRange;
/**
*
* option.baseRefer 默认为'min'
* option.stepHandle 默认为 (step: number) => step
* getSplitInfoOf({min: 0.1, max: 0.52, splitNumber: 4}) => {min: 0.1, max: 0.52, splitNumber: 4, step: 0.10500000000000001}
*/
export declare function getSplitInfoOf(splitInfo: NSFuncRange.IBaseSplitInfo, option?: Partial<NSFuncRange.IExtraSplitInfo>): NSFuncRange.IBaseSplitInfoStep;
/**
*
* option.baseRefer 默认为'min'
* option.stepHandle 默认为 (step: number) => Math.ceil(step);
* getSplitInfoIntStep({min: 0.1, max: 0.52, splitNumber: 4}) => min: 0, max: 1, splitNumber: 4, step: 0.25}
*/
export declare function getSplitInfoIntStep(splitInfo: NSFuncRange.IBaseSplitInfo, option: Partial<NSFuncRange.IExtraSplitInfo>): NSFuncRange.IBaseSplitInfoStep;
/**
* option.timesBase = 10
* option.baseRefer 默认为'min'
* option.stepHandle 默认为 (step: number) => Math.ceil(step);
* getSplitInfoTimesStep({min: 0.1, max: 0.52, splitNumber: 4}) => {min: 0, max: 40, splitNumber: 4, step: 10}
*/
export declare function getSplitInfoTimesStep(splitInfo: NSFuncRange.IBaseSplitInfo, option: Partial<NSFuncRange.IBaseSplitInfoStepTimes>): NSFuncRange.IBaseSplitInfoStep;
export declare namespace NSFileRelate {
interface IBase64RegResultMatch {
isMatch: true;
dataType: string;
dataSuffix: string;
dataData: string;
mime: string;
}
interface ParsedPath {
root: string;
dir: string;
base: string;
name: string;
ext: string;
isMatch: boolean;
}
interface IBase64RegResultNotMatch {
isMatch: false;
}
type TBase64RegResult = IBase64RegResultNotMatch | IBase64RegResultMatch;
}
export declare function getDataFromBase64String(base64String: string): NSFileRelate.TBase64RegResult;
export declare function parsePath(pathname: string): NSFileRelate.ParsedPath;
declare class SinglePrivateMap<TBindObj extends object, TObjectPropertyDict extends object> {
private readonly bindObj;
private readonly privateMap;
constructor(bindObj: TBindObj, map: PrivateMap<TBindObj, TObjectPropertyDict>);
setDict(dict: TObjectPropertyDict): this;
getDict(): TObjectPropertyDict | undefined;
safeGetDict(): TObjectPropertyDict;
setProperty<KeyName extends keyof TObjectPropertyDict>(keyName: KeyName, value: TObjectPropertyDict[KeyName]): this;
safeSetProperty<KeyName extends keyof TObjectPropertyDict>(keyName: KeyName, value: TObjectPropertyDict[KeyName]): this;
getProperty<KeyName extends keyof TObjectPropertyDict>(keyName: KeyName): TObjectPropertyDict[KeyName];
safeGetProperty<KeyName extends keyof TObjectPropertyDict>(keyName: KeyName): TObjectPropertyDict[KeyName];
}
export declare class PrivateMap<TBindObj extends object = {}, TObjectPropertyDict extends object = {}> {
private bindMap;
constructor();
setDict(bindObj: TBindObj, dict: TObjectPropertyDict): this;
getDict(bindObj: TBindObj): TObjectPropertyDict | undefined;
safeGetDict(bindObj: TBindObj): TObjectPropertyDict;
setProperty<KeyName extends keyof TObjectPropertyDict>(bindObj: TBindObj, keyName: KeyName, value: TObjectPropertyDict[KeyName]): this;
safeSetProperty<KeyName extends keyof TObjectPropertyDict>(bindObj: TBindObj, keyName: KeyName, value: TObjectPropertyDict[KeyName]): this;
getProperty<KeyName extends keyof TObjectPropertyDict>(bindObj: TBindObj, keyName: KeyName): TObjectPropertyDict[KeyName];
safeGetProperty<KeyName extends keyof TObjectPropertyDict>(bindObj: TBindObj, keyName: KeyName): TObjectPropertyDict[KeyName];
getSingleBindInstance(bindObj: TBindObj): SinglePrivateMap<TBindObj, TObjectPropertyDict>;
}
export {};
/**
* 将setTimeout转成Promise
* @param **delayTime**
*/
export declare function delay(delayTime?: number): Promise<void>;
Generated using TypeDoc