helper.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829
  1. import { DisplayObject } from '@antv/g';
  2. export declare function identity<T>(x: T): T;
  3. type Func<R> = (x: R, ...args: any[]) => R;
  4. /**
  5. * Composes functions from left to right.
  6. */
  7. export declare function compose<R>(fns: Func<R>[]): Func<R>;
  8. /**
  9. * Composes single-argument async functions from left to right.
  10. */
  11. export declare function composeAsync<R>(fns: ((x: R) => Promise<R> | R)[]): (x: R) => Promise<R> | R;
  12. export declare function capitalizeFirst(str: string): string;
  13. export declare function error(message?: string): never;
  14. export declare function copyAttributes(target: DisplayObject, source: DisplayObject): void;
  15. export declare function defined(x: any): boolean;
  16. export declare function random(a: number, b: number): number;
  17. export declare function useMemo<T = unknown, U = unknown>(compute: (key: T) => U): (key: T) => U;
  18. export declare function appendTransform(node: DisplayObject, transform: any): void;
  19. export declare function subObject(obj: Record<string, any>, prefix: string): Record<string, any>;
  20. export declare function maybeSubObject(obj: Record<string, any>, prefix: string): Record<string, any>;
  21. export declare function prefixObject(obj: Record<string, any>, prefix: string): Record<string, any>;
  22. export declare function filterPrefixObject(obj: Record<string, any>, prefix: string[]): Record<string, any>;
  23. export declare function omitPrefixObject(obj: Record<string, any>, ...prefixes: string[]): {
  24. [k: string]: any;
  25. };
  26. export declare function maybePercentage(x: number | string, size: number): number;
  27. export declare function isStrictObject(d: any): boolean;
  28. export declare function isUnset(value: any): boolean;
  29. export {};