Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

chain-lightning

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chain-lightning - npm Package Compare versions

Comparing version
0.2.0
to
0.2.1
+21
-5
lib/chainlightning.js

@@ -56,2 +56,10 @@ /*

// Array.prototype.includes() uses this for value equality
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
function isIdenticalTo( x , y ) {
return x === y || ( Number.isNaN( x ) && Number.isNaN( y ) ) ;
}
List.prototype.values = function *() {

@@ -94,10 +102,18 @@ var current = this.head ;

// Array.prototype.includes() uses this for value equality
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
function isIdenticalTo( x , y ) {
return x === y || ( Number.isNaN( x ) && Number.isNaN( y ) ) ;
}
// Similar to .keys()
List.prototype.slots = function slots() {
var slots = new Array( this.length ) ,
index = 0 ,
current = this.head ;
while ( current ) {
slots[ index ++ ] = current ;
current = current.next ;
}
return slots ;
} ;
List.prototype.push =

@@ -104,0 +120,0 @@ List.prototype.append = function append( ... elements ) {

+1
-1
{
"name": "chain-lightning",
"version": "0.2.0",
"version": "0.2.1",
"description": "Linked list",

@@ -5,0 +5,0 @@ "main": "lib/chainlightning.js",

@@ -202,2 +202,29 @@ /*

it( ".slots()" , () => {
var slots ;
var list ,
e1 = { v: 'jack' } ,
e2 = { v: 'bob' } ,
e3 = { v: 'steve' } ,
e4 = { v: 'bobby' } ;
list = new List( e1 , e2 , e3 ) ;
slots = list.slots() ;
expect( slots ).to.be.an( Array ) ;
expect( slots ).to.have.length( 3 ) ;
expect( slots.map( e => e.element ) ).to.equal( [ e1 , e2 , e3 ] ) ;
list = new List() ;
slots = list.slots() ;
expect( slots ).to.be.an( Array ) ;
expect( slots ).to.have.length( 0 ) ;
expect( slots.map( e => e.element ) ).to.equal( [] ) ;
list = new List( e1 , e2 , e2 , e2 , e3 ) ;
slots = list.slots() ;
expect( slots ).to.be.an( Array ) ;
expect( slots ).to.have.length( 5 ) ;
expect( slots.map( e => e.element ) ).to.equal( [ e1 , e2 , e2 , e2 , e3 ] ) ;
} ) ;
it( ".slotOf()/.lastSlotOf()" , () => {

@@ -204,0 +231,0 @@ var list ,