npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nv-data-linked-list

v1.0.4

Published

linked-list

Readme

nv-data-linked-list

  • nv-data-linked-list is very simple util of Double Linked List
  • its a simplified version of nv-data-dlink
  • fewer APIS. but easy to use
  • two mode: function / klass

install

  • npm install nv-data-linked-list

usage

function mode

const {
    init,
    append,
    is_empty,
    head,
    tail,
    gen,
    get_item,
    arrize,
    ////
    new_item,
    disconn,
    insert_before,
    insert_after,
    next,
    prev,
    index_of,
    gen_psibs,
    gen_fsibs,
    psibs,
    fsibs,
    list
    ////
} = require("nv-data-linked-list").llfunc;

var l = init()
> is_empty(l)
true
>

var nd0 = append(l)
nd0.tag = "nd0"
var nd1 = append(l)
nd1.tag = "nd1"
var nd2 = append(l)
nd2.tag = "nd2"
var nd3 = append(l)
nd3.tag = "nd3"

> arrize(l)
[ { tag: 'nd0' }, { tag: 'nd1' }, { tag: 'nd2' }, { tag: 'nd3' } ]
>
> get_item(l,0)
{ tag: 'nd0' }
> get_item(l,1)
{ tag: 'nd1' }
> get_item(l,2)
{ tag: 'nd2' }
> get_item(l,3)
{ tag: 'nd3' }


> head(l)
{ tag: 'nd0' }
> tail(l)
{ tag: 'nd3' }
>
> next(nd0)
{ tag: 'nd1' }
> next(nd1)
{ tag: 'nd2' }
> next(nd2)
{ tag: 'nd3' }
> next(nd3)
{}
> next(l)
{ tag: 'nd0' }
>
> prev(l)
{ tag: 'nd3' }
> prev(nd3)
{ tag: 'nd2' }
> prev(nd2)
{ tag: 'nd1' }
> prev(nd1)
{ tag: 'nd0' }
> prev(nd0)
{}
>

> index_of(nd0)
0
> index_of(nd1)
1
> index_of(nd2)
2
> index_of(nd3)
3
> list(nd0) === list(nd2)


var l = init()
var nd0 = append(l)
nd0.tag = "nd0"
var nd1 = append(l)
nd1.tag = "nd1"
var nd2 = append(l)
nd2.tag = "nd2"
var nd3 = append(l)
nd3.tag = "nd3"

> Array.from(gen(l))
[ { tag: 'nd0' }, { tag: 'nd1' }, { tag: 'nd2' }, { tag: 'nd3' } ]
>

var nh = insert_before(nd0)
nh.tag = 'nh'
Array.from(gen(l))
/*
[
  { tag: 'nh' },
  { tag: 'nd0' },
  { tag: 'nd1' },
  { tag: 'nd2' },
  { tag: 'nd3' }
]

*/
var ntail = insert_after(nd3)
ntail.tag = "nt"
Array.from(gen(l))
/*
[
  { tag: 'nh' },
  { tag: 'nd0' },
  { tag: 'nd1' },
  { tag: 'nd2' },
  { tag: 'nd3' },
  { tag: 'nt' }
]
>
*/

var n23 = insert_after(nd2)
n23.tag = 'n23'
> Array.from(gen(l))
[
  { tag: 'nh' },
  { tag: 'nd0' },
  { tag: 'nd1' },
  { tag: 'nd2' },
  { tag: 'n23' },
  { tag: 'nd3' },
  { tag: 'nt' }
]
>

APIS

  • llfunc.init(list)
  • llfunc.append(list, item)
  • llfunc.is_empty(list)
  • llfunc.head(list)
  • llfunc.tail(list)
  • llfunc.length(list)
  • llfunc.gen(list)
  • llfunc.get_item(list,index)
  • llfunc.arrize(list)
  • llfunc.disconn(item)
  • llfunc.insert_before(item,new_item)
  • llfunc.insert_after(item,new_item)
  • llfunc.next(item)
  • llfunc.prev(item)
  • llfunc.index_of(item)
  • gen_psibs(item,including_self=false)
  • gen_fsibs(item,including_self=false)
  • psibs(item,including_self=false)
  • fsibs(item,including_self=false)
  • llfunc.list(item)
  • llfunc.from_ary(arr)
  • llfunc.to_ary(arr)

class mode

const {L} = require("nv-data-linked-list").llcls;


var l = new L()
var nd0 = l.append()
nd0.tag = "nd0"
var nd1 = l.append()
nd1.tag = "nd1"
var nd2 = l.append()
nd2.tag = "nd2"
var nd3 = l.append()
nd3.tag = "nd3"
> Array.from(l)
[
  Node { tag: 'nd0' },
  Node { tag: 'nd1' },
  Node { tag: 'nd2' },
  Node { tag: 'nd3' }
]
>
> l.length
4
>

var nh = l.prepend()
nh.tag = "head"
var nt = l.append()
nt.tag = "tail"

> l.head
Node { tag: 'head' }
> l.tail
Node { tag: 'tail' }
>
var nd01 = l.insert_at(0)
nd01.tag = "nd01"
> Array.from(l)
[
  Node { tag: 'nd01' },
  Node { tag: 'head' },
  Node { tag: 'nd0' },
  Node { tag: 'nd1' },
  Node { tag: 'nd2' },
  Node { tag: 'nd3' },
  Node { tag: 'tail' }
]
>
> Array.from(l)
[
  Node { tag: 'nd01' },
  Node { tag: 'head' },
  Node { tag: 'nd0' },
  Node { tag: 'nd1' },
  Node { tag: 'nd2' },
  Node { tag: 'nd3' },
  Node { tag: 'tail' }
]
> nd01.disconn()
undefined
> Array.from(l)
[
  Node { tag: 'head' },
  Node { tag: 'nd0' },
  Node { tag: 'nd1' },
  Node { tag: 'nd2' },
  Node { tag: 'nd3' },
  Node { tag: 'tail' }
]
>

> nd2.psibs
[ Node { tag: 'head' }, Node { tag: 'nd0' }, Node { tag: 'nd1' } ]
>
> nd2.fsibs
[ Node { tag: 'nd3' }, Node { tag: 'tail' } ]
>

METHODS

List

l.append                l.get_item              l.head
l.index_of              l.insert_at             l.is_empty              l.length
l.prepend               l.rm_at                 l.tail                  l.to_array
l[Symbol.iterator]

Node

nd0.disconn               nd0.fsibs
nd0.gen_fsibs             nd0.gen_psibs             nd0.index_of
nd0.insert_after          nd0.insert_before         nd0.is_head
nd0.is_lonely             nd0.is_tail               nd0.list
nd0.next                  nd0.prev                  nd0.psibs

LICENSE

  • ISC