Socket
Socket
Sign inDemoInstall

@slimlib/list

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @slimlib/list

Doubly linked list


Version published
Weekly downloads
16
increased by45.45%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

List

Doubly linked list implementation in typescript.

Changelog

Installation

Using npm:

npm install --save-dev @slimlib/list

API

List() constructor

No arguments. Constructs a new list object.

const list = new List;
const list = new List<NodeType>();

[Symbol.iterator]()

List provides an iterator using the [Symbol.iterator]() method. Most commonly used in cases where another statement/method consumes an iterable object.

Array.from(list);
for (const item of list) {
    // something with item
}

append(element, data)

inserts an element after element (at the end of the list in case of list)

element - ListNode or List itself to add a new element after

data - object that will become a ListNode

appendRange(element, begin, end)

inserts a range of elements after element (at the end of the list in case of list)

element - ListNode or List itself to add range after

begin - first ListNode of a range

end - last ListNode of a range

prepend(element, data)

inserts an element before element (at the beginning of the list in case of list)

element - ListNode or List itself to add a new element before

data - object that will become a ListNode

prependRange(element, begin, end)

inserts a range of elements before element (at the beginning of the list in case of list)

element - ListNode or List itself to insert range before

begin - first ListNode of a range

end - last ListNode of a range

License

MIT

Keywords

FAQs

Last updated on 11 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc