algorithmUtil.d.ts 638 B

1234567891011121314151617181920212223
  1. import type * as React from 'react';
  2. /**
  3. * Get index with specific start index one by one. e.g.
  4. * min: 3, max: 9, start: 6
  5. *
  6. * Return index is:
  7. * [0]: 6
  8. * [1]: 7
  9. * [2]: 5
  10. * [3]: 8
  11. * [4]: 4
  12. * [5]: 9
  13. * [6]: 3
  14. */
  15. export declare function getIndexByStartLoc(min: number, max: number, start: number, index: number): number;
  16. /**
  17. * We assume that 2 list has only 1 item diff and others keeping the order.
  18. * So we can use dichotomy algorithm to find changed one.
  19. */
  20. export declare function findListDiffIndex<T>(originList: T[], targetList: T[], getKey: (item: T) => React.Key): {
  21. index: number;
  22. multiple: boolean;
  23. } | null;