{"id":15445841,"url":"https://github.com/scriptnull/ds-sll","last_synced_at":"2025-04-04T18:17:43.204Z","repository":{"id":57216664,"uuid":"47811750","full_name":"scriptnull/ds-sll","owner":"scriptnull","description":"JS implementation of Singly Linked Lists","archived":false,"fork":false,"pushed_at":"2017-04-11T10:02:14.000Z","size":3186,"stargazers_count":0,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-25T00:26:53.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scriptnull.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-11T07:26:03.000Z","updated_at":"2016-01-11T11:37:26.000Z","dependencies_parsed_at":"2022-08-28T21:01:08.958Z","dependency_job_id":null,"html_url":"https://github.com/scriptnull/ds-sll","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptnull%2Fds-sll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptnull%2Fds-sll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptnull%2Fds-sll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptnull%2Fds-sll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scriptnull","download_url":"https://codeload.github.com/scriptnull/ds-sll/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246976131,"owners_count":20863021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T19:46:21.758Z","updated_at":"2025-04-04T18:17:43.179Z","avatar_url":"https://github.com/scriptnull.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/scriptnull/ds-sll.svg?branch=master)](https://travis-ci.org/scriptnull/ds-sll)\n[Shippable CI](https://app.shippable.com/projects/5670fd691895ca4474666b0a)\n\n## Install \n\nvia npm \n```bash\nnpm install ds-sll\n```\nvia git\n```bash\ngit clone https://github.com/scriptnull/ds-sll.git\n```\n## Usage \n```javascript\nvar ds = require('ds-sll')\n , LinkedList = ds.LinkedList\n , Node = ds.Node ;\n```\n\n## Node\nNodes are elementary blocks of Linked List. To maintain data within Linked List, use Node objects as containers. Nodes have data and a pointer to next node.\n\n### Creating a node \n```javascript \nvar numberNode = new Node(1);\nvar stringNode = new Node('yo');\nvar objectNode = new Node({ foo : 'bar'});\n```\n\n### Properties\n```javascript \nvar node = new Node(1);\nconsole.log(node.data);  //1 - data of node\nconsole.log(node.next);  //null - next pointer\n```\n\n### Methods\n- setNext(node) \n- getNext()\n\n## Linked List\nSingly Linked Lists are collection of Node objects having only next pointer.\n\n### Creating a Linked List \n```javascript\nvar ll = new LinkedList();\n```\n\n### Properties\n```javascript\nvar ll = new LinkedList();\nconsole.log(ll.length); // 0 - length of linked list\nconsole.log(ll.head);   // null - head of the linked list\n```\n\n### Methods \n- insertAtHead(node)\n- insertAtTail(node)\n- insertAtPosition(node,position)\n- deleteAtHead()\n- deleteAtTail()\n- deleteAtPosition(position)\n- getDataAtPosition(position)\n- findPositionByData(data)\n\n## Contributing\nAny kind of contribution is welcomed. If you are adding new features , be sure to write the required tests for it.\n\n## Tests\nTests are written with Mocha + inbuilt Node.js assert library.\nInitail commit has about 30+ tests. If you feel ds-sll is going wrong somewhere. You could report it in issues or better submit a pull request by describing the case in a test suite. \nYou can track the build status from [travis-ci](https://travis-ci.org/scriptnull/ds-sll)\n\n## License\n![](https://raw.githubusercontent.com/scriptnull/bagpack/master/GPL.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptnull%2Fds-sll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscriptnull%2Fds-sll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptnull%2Fds-sll/lists"}