Browse Source

update ts

es6
zsmj 2 years ago
parent
commit
220ac9a53f
  1. 108
      typescript/core/base.ts

108
typescript/core/base.ts

@ -1,7 +1,7 @@
import { _Widget } from "./widget";
export interface _base {
assert: (v: any, is: Function) => Boolean
assert: (v: any, is: Function) => Boolean;
warn: (message: any) => Boolean;
@ -15,62 +15,62 @@ export interface _base {
packageItems: (items: any[], layouts: any[]) => any[];
formatEL: <T>(obj: T) => {el: T} | T
formatEL: <T>(obj: T) => { el: T } | T;
stripEL: <T>(obj: {el: T} | T) => T;
stripEL: <T>(obj: { el: T } | T) => T;
trans2Element: (widgets: any[]) => any[];
// 集合相关方法
where: (collection: any[]|object|string, source: object) => any[];
where: (collection: any[] | object | string, source: object) => any[];
findWhere: (collection: any[]|object|string, callback?: Function|object|string, thisArg?: any) => object|undefined;
findWhere: (collection: any[] | object | string, callback?: Function | object | string, thisArg?: any) => object | undefined;
invoke: (collection: any[]|object|string, methodName: Function|string, arg?: any) => any[];
invoke: (collection: any[] | object | string, methodName: Function | string, arg?: any) => any[];
pluck: (collection: any[]|object|string, property: string) => any[];
pluck: (collection: any[] | object | string, property: string) => any[];
shuffle: (collection: any[]|object|string) => any[];
shuffle: (collection: any[] | object | string) => any[];
sample: (collection: any[]|object|string, n?: number) => any[];
sample: (collection: any[] | object | string, n?: number) => any[];
toArray: (collection: any[]|object|string) => any[];
toArray: (collection: any[] | object | string) => any[];
size: (collection: any) => number;
each: <T>(collection: T[]|object|string, callback?: ((index: number, value: T) => void)|object|string, thisArg?: any) => any;
each: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => void) | object | string, thisArg?: any) => any;
map: <T, U>(collection: T[]|object|string|null|undefined, callback?: ((index: number, value: T) => U)|object|string, thisArg?: any) => U[];
map: <T, U>(collection: T[] | object | string | null | undefined, callback?: ((index: number, value: T) => U) | object | string, thisArg?: any) => U[];
reduce: <T, U>(collection: T[]|object|string, callback?: ((total: U extends T ? U : T, currentValue: T, currentIndex: number) => U extends T ? U : T)|object|string, initialValue?: U|T) => U extends T ? U : T;
reduce: <T, U>(collection: T[] | object | string, callback?: ((total: U extends T ? U : T, currentValue: T, currentIndex: number) => U extends T ? U : T) | object | string, initialValue?: U | T) => U extends T ? U : T;
reduceRight: <T, U>(collection: T[]|object|string, callback?: ((total: U extends T ? U : T, currentValue: T, currentIndex: number) => U extends T ? U : T)|object|string, initialValue?: U|T) => U extends T ? U : T;
reduceRight: <T, U>(collection: T[] | object | string, callback?: ((total: U extends T ? U : T, currentValue: T, currentIndex: number) => U extends T ? U : T) | object | string, initialValue?: U | T) => U extends T ? U : T;
find: <T>(collection: T[]|object|string, callback?: ((index: number, value: T) => boolean)|object|string, thisArg?: any) => T | undefined;
find: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => T | undefined;
filter: <T>(collection: T[]|object|string, callback?: ((index: number, value: T) => boolean)|object|string, thisArg?: any) => T[];
filter: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => T[];
reject: <T>(collection: T[]|object|string, callback?: ((index: number, value: T) => boolean)|object|string, thisArg?: any) => T[];
reject: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => T[];
every: <T>(collection: T[]|object|string, callback?: ((index: number, value: T) => boolean)|object|string, thisArg?: any) => boolean;
every: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => boolean;
all: <T>(collection: T[]|object|string, callback?: ((index: number, value: T) => boolean)|object|string, thisArg?: any) => boolean;
all: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => boolean;
some: <T>(collection: T[]|object|string, callback?: ((index: number, value: T) => boolean)|object|string, thisArg?: any) => boolean;
some: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => boolean;
any: <T>(collection: T[]|object|string, callback?: ((index: number, value: T) => boolean)|object|string, thisArg?: any) => boolean;
any: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => boolean) | object | string, thisArg?: any) => boolean;
max: <T>(collection: T[]) => T;
min: <T>(collection: T[]) => T;
sortBy: <T>(collection: any[]|object|string, callback?: ((index: number, value: T) => number)|object|string, thisArg?: any) => any[];
sortBy: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => number) | object | string, thisArg?: any) => any[];
groupBy: <T>(collection: any[]|object|string, callback?: ((index: number, value: T) => any)|object|string, thisArg?: any) => object;
groupBy: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => any) | object | string, thisArg?: any) => object;
indexBy: <T>(collection: any[]|object|string, callback?: ((index: number, value: T) => any)|object|string, thisArg?: any) => object;
indexBy: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => any) | object | string, thisArg?: any) => object;
countBy: <T>(collection: any[]|object|string, callback?: ((index: number, value: T) => any)|object|string, thisArg?: any) => object;
countBy: <T>(collection: any[] | object | string, callback?: ((index: number, value: T) => any) | object | string, thisArg?: any) => object;
count: (from: number, to: number, predicate: Function) => number;
@ -99,7 +99,7 @@ export interface _base {
remove: (obj: any, predicate: any, context?: any) => void;
removeAt: (obj: any, index: number|number[]) => void;
removeAt: (obj: any, index: number | number[]) => void;
string2Array: (str: string) => string[];
@ -110,17 +110,17 @@ export interface _base {
int2Abc: (num: number) => string;
// 数组相关的方法
first: <T>(array: T[], callback?: Function|object|number|string, thisArg?: any) => T;
first: <T>(array: T[], callback?: Function | object | number | string, thisArg?: any) => T;
initial: <T>(array: T[], callback?: Function|object|number|string, thisArg?: any) => T[];
initial: <T>(array: T[], callback?: Function | object | number | string, thisArg?: any) => T[];
last: <T>(array: T[], callback?: Function|object|number|string, thisArg?: any) => T;
last: <T>(array: T[], callback?: Function | object | number | string, thisArg?: any) => T;
rest: <T>(array: T[], callback?: Function|object|number|string, thisArg?: any) => T[];
rest: <T>(array: T[], callback?: Function | object | number | string, thisArg?: any) => T[];
compact: (array: any[]) => any[];
flatten: (array: any[], isShallow?: boolean, callback?: Function|object|string, thisArg?: any) => any[];
flatten: (array: any[], isShallow?: boolean, callback?: Function | object | string, thisArg?: any) => any[];
without: (array: any[], value?: any) => any[];
@ -140,7 +140,7 @@ export interface _base {
lastIndexOf: (array: any[], value: any, fromIndex?: number) => number;
sortedIndex: (array: any[], value: any, callback?: Function|object|string, thisArg?: any) => number;
sortedIndex: (array: any[], value: any, callback?: Function | object | string, thisArg?: any) => number;
range: (start: number, end: number, step: number) => number[];
@ -148,9 +148,9 @@ export interface _base {
takeRight: <T>(array: T[], n: number) => T[];
findIndex: (array: any[], value: any, callback?: Function|object|string, thisArg?: any) => number;
findIndex: (array: any[], value: any, callback?: Function | object | string, thisArg?: any) => number;
findLastIndex: (array: any[], value: any, callback?: Function|object|string, thisArg?: any) => number;
findLastIndex: (array: any[], value: any, callback?: Function | object | string, thisArg?: any) => number;
makeArray: <T>(length: number, value?: T) => number[] | T[];
@ -181,7 +181,7 @@ export interface _base {
clone: <T>(object: T) => T;
property: (path: any[]|string) => Function;
property: (path: any[] | string) => Function;
propertyOf: (object: object) => Function;
@ -189,7 +189,7 @@ export interface _base {
isMatch: (object: object, source: object, customizer?: Function, thisArg?: any) => boolean;
isEmpty: (value: any[]|object|string|null|undefined|number) => boolean;
isEmpty: (value: any[] | object | string | null | undefined | number) => boolean;
isElement: (value: any) => boolean;
@ -225,11 +225,11 @@ export interface _base {
cloneDeep: <T>(value: T) => T;
findKey: (object: object, predicate?: Function|object|string, thisArg?: any) => any;
findKey: (object: object, predicate?: Function | object | string, thisArg?: any) => any;
pick: (object: object, predicate?: Function|string|string[], thisArg?: any) => object;
pick: (object: object, predicate?: Function | string | string[], thisArg?: any) => object;
omit: (object: object, predicate?: Function|string|string[], thisArg?: any) => object;
omit: (object: object, predicate?: Function | string | string[], thisArg?: any) => object;
tap: (value: any, interceptor: Function, thisArg?: any) => any;
@ -237,21 +237,21 @@ export interface _base {
init: () => void;
has: (obj: object, keys: string|string[]) => boolean;
has: (obj: object, keys: string | string[]) => boolean;
freeze: <T>(value: T) => T;
isKey: (key: any) => key is (number | string);
isCapitalEqual: (a: string|null|undefined, b: string|null|undefined) => boolean;
isCapitalEqual: (a: string | null | undefined, b: string | null | undefined) => boolean;
isWidthOrHeight: (w: number|string) => boolean;
isWidthOrHeight: (w: number | string) => boolean;
isNotNull: <T>(obj: T) => obj is NonNullable<T>;
isNull: (obj: any) => obj is (undefined | null);
isEmptyArray: <T, U>(arr: T[] | U) => arr is T[] & {length: 0};
isEmptyArray: <T, U>(arr: T[] | U) => arr is T[] & { length: 0 };
isNotEmptyArray: <T, U>(arr: T[] | U) => arr is [T, ...T[]];
@ -263,7 +263,7 @@ export interface _base {
deepClone: <T>(obj: T) => T;
deepExtend: merge['deepExtend'];
deepExtend: merge["deepExtend"];
isDeepMatch: (object: any, attrs: any) => boolean;
@ -307,7 +307,7 @@ export interface _base {
wrap: (value: any, wrapper: Function) => Function;
nextTick: (func: Function) => Promise<any>;
nextTick: (func?: Function) => Promise<any>;
random: (min?: number, max?: number, floating?: boolean) => number;
@ -317,21 +317,21 @@ export interface _base {
parseFloat: (string: string) => number;
isNaturalNumber: (value: string|number) => boolean;
isNaturalNumber: (value: string | number) => boolean;
isPositiveInteger: (value: string|number) => boolean;
isPositiveInteger: (value: string | number) => boolean;
isNegativeInteger: (value: string|number) => boolean;
isNegativeInteger: (value: string | number) => boolean;
isInteger: (value: string|number) => boolean;
isInteger: (value: string | number) => boolean;
isNumeric: (value: string|number) => boolean;
isNumeric: (value: string | number) => boolean;
isFloat: (value: string|number) => boolean;
isFloat: (value: string | number) => boolean;
isOdd: (value: string|number) => boolean;
isOdd: (value: string | number) => boolean;
isEven: (value: string|number) => boolean;
isEven: (value: string | number) => boolean;
sum: (array: any[], iteratee?: Function, context?: any) => number;
@ -367,7 +367,7 @@ export interface _base {
isLeapYear: (year: number) => boolean;
checkDateVoid: (YY: string | number, MM: string | number, DD: string | number, minDate: string, maxDate: string) => (number|string)[];
checkDateVoid: (YY: string | number, MM: string | number, DD: string | number, minDate: string, maxDate: string) => (number | string)[];
checkDateLegal: (str: string) => boolean;

Loading…
Cancel
Save