index.d.ts 727 B

12345678910111213141516171819202122232425262728293031
  1. declare class Denque<T = any> {
  2. constructor();
  3. constructor(array: T[]);
  4. constructor(array: T[], options: IDenqueOptions);
  5. push(item: T): number;
  6. unshift(item: T): number;
  7. pop(): T | undefined;
  8. removeBack(): T | undefined;
  9. shift(): T | undefined;
  10. peekBack(): T | undefined;
  11. peekFront(): T | undefined;
  12. peekAt(index: number): T | undefined;
  13. get(index: number): T | undefined;
  14. remove(index: number, count: number): T[];
  15. removeOne(index: number): T | undefined;
  16. splice(index: number, count: number, ...item: T[]): T[] | undefined;
  17. isEmpty(): boolean;
  18. clear(): void;
  19. toString(): string;
  20. toArray(): T[];
  21. length: number;
  22. }
  23. interface IDenqueOptions {
  24. capacity?: number
  25. }
  26. export = Denque;