@slimlib/list
TypeScript icon, indicating that this package has built-in type declarations

1.0.10 • Public • Published

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

Package Sidebar

Install

npm i @slimlib/list

Weekly Downloads

56

Version

1.0.10

License

MIT

Unpacked Size

9.77 kB

Total Files

9

Last publish

Collaborators

  • kshutkin