Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
double-linkedlist
Advanced tools
Readme
Version 1.0.0 changed the way you instantiate for node. See the getting started section for more on how to get started. Also please see change log for deprecated methods.
This is a simple double linked list. It has some tests but still use discretion. You will have to create a new object to use it so for browsers...
var linkedList = new DoubleLinkedList()
and for node...
var DoubleLinkedList = require('double-linkedlist').DoubleLinkedList;
var linkedList = new DoubleLinkedList();
Double Linked List
Meta
Will trigger all the functions given to it when objects are added, removed or moved.
Parameters
func
function called when a change occursdetermines if there are any more undo left
Returns boolean
will undo the last modifying command
removes all the undo that the user can perform
is this data list empty?
Returns boolean
Returns the size of this list
Returns Number
Inserts data at the start of the list
Parameters
Inserts data at the end of the list
Parameters
Inserts data at a specified position the list
Parameters
removes a node at the specified position
Parameters
position
Number index of the node you want to removeremoves all the nodes
removes a node at the specified position
Parameters
comparitor
Comparitor function that cycles through each element
returning the node and index. The user must return true or false to indicate whether or not the
node should be removed.isReversed
{Boolean} to cycle through the list in reverseExamples
list.removeNode(function(node, idx){
return node.id === 4
},true)
Returns Object the node at the end of the list
Returns Object the node at the start of the list
moves the object
Parameters
oldIdx
Number the index of the object you want to movenewIdx
Number the index you want to move the old object tocycles through each node and returns it along with the previous node, the next node and the index to the callback. To break free from the cycle the user can return false or let it run to the end
Parameters
callback
Psychic-Callback function that cycles through each element
returning the node and index.isReversed
Boolean to cycle through the list in reverseExamples
list.psychic(function(currentNode, previousNode, nextNode, idx){
// Do something with the node
// return true to keep going or false to stop
})
returns an array of the data
Returns Array the internal data as an array
removes a node at the specified position
Parameters
comparitor
(Comparitor | Object) function that cycles through each element
returning the node and index. The user must return true or false to indicate whether or not the
node should be removed. Or it can be an object and the method will find any node that matches the attribute's
dataExamples
var array = list.findAll(function(node, idx){
return node.id === 4
})
var list = list.findAll({id:4})
Type: Function
Parameters
currentNode
LinkNode The current node object in the listpreviousNode
LinkNode The previous node object in the listnextNode
LinkNode The next node object in the listidx
Number index of the object in the listReturns boolean Optionally the user can return false to break free from the cycle early
Type: Function
Parameters
Returns boolean the user should return true any time a condition is met while comparing the node
Type: Function
Parameters
Returns boolean Optionally the user can return false to break free from the cycle early
class that represents the nodes that make up the list. Each of the node are referenced to at most two other nodes - a previous and a next.
Parameters
data
any object to storenextNode
a node to reference as nextpreviousNode
a node to reference as previousreturns the node that is after the node that called this method
Returns any LinkNode
returns the node that is before the node that called this method
Returns any LinkNode
takes a node object and sets it as the next node in the linked list
Parameters
obj
Node the node object you want to set as nexttakes a node object and sets it as the previous node in the linked list
Parameters
obj
Node the node object you want to set as previoustrue if there is another node linked after the node that is caller of this method
Returns any Boolean
true if there is another node linked before the node that is caller of this method
Returns any Boolean
Returns any Object
Meta
allows you to set data in the internal object.
Parameters
data
Object the information you want to store the nodekey
String the property you want to store the data atgetter for the internal data stored in the node
Parameters
key
String the attribute property name to access the datasets the internal data object
Parameters
data
Object the information you want to store the nodeFAQs
A double linked list data structure for storing data
The npm package double-linkedlist receives a total of 24 weekly downloads. As such, double-linkedlist popularity was classified as not popular.
We found that double-linkedlist 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.