@toolbox-ts/dsa
Version:
Data Structures and Algorithms implemented
29 lines • 844 B
JavaScript
import { Manager as NodeManager } from "../_Manager/index.js";
/**
* Creates a doubly linked list node manager with anchor
* and pointer management.
*
* Provides methods for node creation,
* pointer mutation, unlinking, and traversal.
*
* @template AK - Anchor key string type
* @template D - Data type stored in the node
* @param cfg - Configuration object for anchors and node creation
* @returns An API for managing doubly linked list nodes
*/
export const create = (cfg) => {
const { anchors, createNode, pointerKeys, type, setPointer } = NodeManager.create({
...cfg,
type: "doubly",
pointerKeys: ["next", "prev"],
});
const api = {
type,
anchors,
pointerKeys,
setPointer,
create: createNode,
};
return api;
};
//# sourceMappingURL=doubly.js.map