
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
digital-chain
Advanced tools
A linked list implementation
a doubly linked list
returns the current length of the list
push an item to the tail of this list
item
Variant any kind of item can be pushedReturns ListNode the node wrapping the item, nodes can be used in methods such as remove()
push all the items at the tail of the list the following are equivalent:
list.pushAll(1, 2, 3)
list.pushAll([1, 2], 3)
list.pushAll([1, 2, 3])
to push an array as a single item use .push(arr)
args
...[Variant] an array or just arguments to be pushed to the listremove the tail of this list, if the list has more than 1 node in it, the previous node will become the new tail of the list
Returns Variant the data from the removed tail node or undefined
if the list was empty
insert an item at the head of this list
item
Variant any kind of item can be insertedReturns ListNode
insert all the items at the head of the list the following are all equivalent:
list.unshiftAll(1, 2, 3)
list.unshiftAll([1, 2], 3)
list.unshiftAll([1, 2, 3])
to push an array as a single item use .push(arr)
args
...[Variant] an array or just arguments to be pushed to the listremove the head of this list, if the list has more than 1 node in it, the next node will become the new head of the list
Returns Variant the data from the removed head node or undefined
if the list was empty
Remove a node from the list
node
ListNode the node to removeReturns Variant the data contained in the removed node
swap the positions of node A and node B inside the list
this method will throw an error if one or more of the arguments is not a Node
or not a member
of this list
Returns Boolean returns true if a swap did occur
sort the list
the default sorting comparator is:
function defaultComparator(a, b) {
if (b > a) return -1
if (b < a) return 1
return 0
}
An ES6 iterator of the nodes in this list, starting from the head
for (let node of list.nodes()) {
console.log(node.data, node.next)
}
Returns ListNodeIterator
An ES6 iterator of the values in this list, starting from the head
for (let value of list.values()) {
console.log(value)
}
Returns ValueIterator
An ES6 iterator of the value and nodes in this list, starting from the head
for (let [data, node] of list) {
console.log(data === node.data)
}
Returns EntryIterator
An ES6 iterator of the value and nodes in this list, starting from the tail
Returns EntryIterator
find the first occurrence of this piece of data in the list, equality test
is performed using ===
data
Variant data to findReturns ListNode the first node that contains this data
find all the occurrences of this piece of data in the list, equality test
is performed using ===
this will traverse the entire list
data
Variant data to findReturns Array<ListNode> an array of nodes that contain this data
finds the first node in the list where the predicate function returns true
predicate
function (Variant) a function that returns true
for nodes that should be included in the search resultsReturns ListNode the first node that was found
finds the all the nodes in the list where the predicate function returns true
predicate
function (Variant) a function that returns true
for nodes that should be included in the search resultsReturns Array<ListNode> an array of nodes that were found
A functional iterator over the nodes in the list, prefer the new ES6 iteration methods over this
Returns [type]
a node in the list
data
parent
documentation readme index.js --section=API
FAQs
A linked list implementation
We found that digital-chain demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.