UNPKG

apply-hooks

Version:

A high-quality & reliable JavaScript Hooks library.

61 lines (60 loc) 1.37 kB
/** * append 添加元素 * insert 指定位置插入元素 * get 获取对应位置的元素 * indexOf 获取元素的索引 如果没有的话 返回-1 * update 修改某个元素的位置 * removeAt 删除某个位置的元素 * remove 移除某个元素 * isEmpty 判断是否为空 * size 返回大小 * forwardString 正向返回元素 * backwardString 反向遍历节点返回 */ interface IAppend<T> { (val: T): boolean; } interface IInsert<T> { (val: T, position?: number): boolean; } interface IGet<T> { (position: number): T | boolean; } interface IIndexOf<T> { (val: T): number; } interface IUpdate<T> { (position: number, val: T): boolean; } interface IRemoveAt<T> { (position: number): T | boolean; } interface IRemove<T> { (val: T): T | boolean; } interface IIsEmpty { (): boolean; } interface ISize { (): number; } interface IForwardString { (splitSign: string): string; } interface IBackwardString { (splitSign: string): string; } declare const useDoublyLinkedList: <T>() => { append: IAppend<T>; insert: IInsert<T>; get: IGet<T>; indexOf: IIndexOf<T>; update: IUpdate<T>; removeAt: IRemoveAt<T>; remove: IRemove<T>; isEmpty: IIsEmpty; size: ISize; forwardString: IForwardString; backwardString: IBackwardString; }; export default useDoublyLinkedList;