2.0.4 • Published 4 years ago

@simamilli/structure v2.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

GitHub package.json version Build Status Coverage Status

structure

Small single linked list.

Installation

npm install @simamilli/structure
yarn add @simamilli/structure

Usage

const {LinkedList} = require(“@simamilli/structure”);
const structure = new LinkedList(5);

// add
structure.add(9);
structure.add(1);
structure.add("a");

// remove by index
structure.remove(2);

// turn to array
const newArr = structure.toArray();

// map nodes and return new list
const newList = structure.map((item) => {
  return {
    data: item,
  };
});
const result = structure.search((data) => data === “d”);

// loop nodes
structure.foreach((item) => {
  console.log(“this is the item:“, item);
});

// search for node
 const result = structure.search((data) => data === "d");

// search by index
const result = structure.searchIndex(1);

AMD

define(function (require, exports, module) {
  var linkedlist = require("structure");
});

Test

npm run test
2.0.4

4 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago