usestack
Version:
This package allows users to use stacks in React applications as a custom hook.
19 lines (17 loc) • 484 B
text/typescript
type StackHook<T> = {
push: (item: T) => void;
pop: () => T | undefined;
peek: () => T | undefined;
clear: () => void;
reset: () => void;
reverse: () => void;
sort: (compareFn?: (a: T, b: T) => number) => void;
shuffle: () => void;
isEmpty: () => boolean;
size: () => number;
values: () => T[];
print: () => void;
version: number;
};
declare function useStack<T>(initialValues?: T[]): StackHook<T>;
export { StackHook, useStack };