dudiharush / linked-list-normalized

Linked list in a normalized data structure (refs by id)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

linked-list-normalized

Linked list in a normalized data structure (refs by id)

installation

npm i linked-list-normalized

usage example

import list from 'linked-list-normalized';

// both will create a normalized linked list of: 1 -> 2 -> 3

const linkedList = list.fromDataArray([1, 2, 3]);

const linkedList = list.fromNodes(
    {id:1, data:1, nextNodeId:2},
    {id:2, data:2, nextNodeId:3},
    {id:3, data:3});

linkedList API:
addNode
removeNode
moveNodeAfter
moveNodeBefore
getNodes
getHeadId
getTailId
getLength

About

Linked list in a normalized data structure (refs by id)

License:MIT License


Languages

Language:TypeScript 96.2%Language:JavaScript 3.8%