JSPM

zelda-lists

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q41452F
  • License MIT

Featuring Link...ed lists

Package Exports

  • zelda-lists

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zelda-lists) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Zelda Lists

npm version GitHub version

Starring Link...ed lists!

Installation

> npm install zelda-lists

Usage

Short story: you can convert any iterable into a Linked List. For ex:

const zelda = require('zelda-lists');

const node = zelda(["foo", "bar"]);

// A node is created for each value
console.log(node.value);      // "foo"
console.log(node.next.value); // "bar"

// The list terminates w/ a null
console.log(node.next.next);  // null

This also works for infinite iterables:

const zelda = require('zelda-lists');

// Returns an infinite iterable
function *gen() {
  for(let i = 0;; ++i) {
    yield i;
  }
}

const node = zelda(gen());

// Feel free to continue w/ this line of testing until you're convinced...
console.log(node.value);                // 0
console.log(node.next.value);           // 1
console.log(node.next.next.value);      // 2
console.log(node.next.next.next.value); // 3