{"_id":"@data-structures-js/linked-list","name":"@data-structures-js/linked-list","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@data-structures-js/linked-list","version":"1.0.0","description":"LinkedList data structure for TypeScript and JavaScript","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.build.json","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run build"},"keywords":["linked-list","data-structure","typescript","javascript"],"author":{"name":"data-structures-js"},"license":"MIT","devDependencies":{"typescript":"^5.3.0"},"gitHead":"ac10bfc21362b2bd04f3f4c144371f24defb8964","_id":"@data-structures-js/linked-list@1.0.0","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-mmnKRZH9prNoDWJgZot0MAbXbLm21/1afTZCDxAjzeKLw32GOZ/Nn5UpVhwIlEItS5INgzPRGbokTmFYRhMnng==","shasum":"44edf5ec2bba1584ffa2121c3bcdd2fba39f4516","tarball":"https://registry.npmjs.org/@data-structures-js/linked-list/-/linked-list-1.0.0.tgz","fileCount":14,"unpackedSize":20008,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBpZztvRDWd9Vns+GBvVsPsOqvli/Yys+FYsHB82+oaPAiEAuywraDtV+66C/FuFNQGdp78siZlMaBxA7yI5gq64iXk="}]},"_npmUser":{"name":"tuanna184","email":"tuanna184.dev@gmail.com"},"directories":{},"maintainers":[{"name":"tuanna184","email":"tuanna184.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/linked-list_1.0.0_1772473381247_0.5918661544207564"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-02T17:43:01.126Z","1.0.0":"2026-03-02T17:43:01.426Z","modified":"2026-03-02T17:43:01.678Z"},"maintainers":[{"name":"tuanna184","email":"tuanna184.dev@gmail.com"}],"description":"LinkedList data structure for TypeScript and JavaScript","keywords":["linked-list","data-structure","typescript","javascript"],"author":{"name":"data-structures-js"},"license":"MIT","readme":"# @data-structures-js/linked-list\n\nSingly linked list data structure for TypeScript and JavaScript.\n\n## Installation\n\n```bash\nnpm install @data-structures-js/linked-list\n```\n\n## Usage\n\n### TypeScript\n\n```typescript\nimport { LinkedList, LinkedListNode } from '@data-structures-js/linked-list';\n\nconst list = new LinkedList<number>();\nlist.insertFirst(1);\nlist.insertLast(2);\nlist.insertLast(3);\n\nconsole.log(list.count());                    // 3\nconsole.log(list.head()?.getValue());         // 1\nconsole.log(list.toArray().map(n => n.getValue())); // [1, 2, 3]\n\nconst removed = list.removeFirst();\nconsole.log(removed?.getValue());             // 1\n\n// From array\nconst list2 = LinkedList.fromArray([1, 2, 3]);\n```\n\n### JavaScript\n\n```javascript\nconst { LinkedList, LinkedListNode } = require('@data-structures-js/linked-list');\n\nconst list = new LinkedList();\nlist.insertFirst(1);\nlist.insertLast(2);\nlist.insertLast(3);\nconsole.log(list.toArray().map(n => n.getValue())); // [1, 2, 3]\n```\n\n## API (matches datastructures-js)\n\n| Method | Description |\n|--------|-------------|\n| `insertFirst(value)` | Add value/node at the beginning |\n| `insertLast(value, startingNode?)` | Add value/node at the end |\n| `insertAt(position, value)` | Add value/node at position |\n| `removeFirst()` | Remove and return head node |\n| `removeLast()` | Remove and return last node |\n| `removeAt(position)` | Remove and return node at position |\n| `head()` | Get head node |\n| `count()` | Number of nodes |\n| `isEmpty()` | Whether list is empty |\n| `toArray()` | Convert to array of nodes |\n| `LinkedList.fromArray(values)` | Create from array |\n\n## Development\n\n```bash\nnpm install\nnpm run build\n```\n","readmeFilename":"README.md","_rev":"1-e376e61711b44322f1b0a0e5ba0bd35d"}