New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sparse-array

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sparse-array - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

12

index.js

@@ -22,3 +22,3 @@ 'use strict'

// remove item from bit array and array itself
this._data.splice(pos, 1)
this._unsetInternalPos(pos)
this._unsetBit(index)

@@ -55,3 +55,4 @@ }

if (this._changed) {
this._length = this._bitArrays.reduce(popCountReduce, 0)
const last = this._data[this._data.length - 1]
this._length = last ? last[0] + 1 : 0
this._changed = false

@@ -84,3 +85,4 @@ }

while(i < this.length) {
acc = reducer(acc, this.get(i), i)
const value = this.get(i)
acc = reducer(acc, value, i)
i++

@@ -143,2 +145,6 @@ }

}
_unsetInternalPos (pos) {
this._data.splice(pos, 1)
}
}

@@ -145,0 +151,0 @@

{
"name": "sparse-array",
"version": "1.2.0",
"version": "1.2.1",
"description": "Sparse array implementation in JS with no dependencies",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -24,2 +24,7 @@ 'use strict'

test('length is 10', (t) => {
t.equal(arr.length, 10)
t.end()
})
test('can get those values', (t) => {

@@ -30,1 +35,36 @@ t.equal(arr.get(9), 'v9')

})
test('delete 6th position', (t) => {
arr.unset(6)
t.end()
})
test('length is still 10', (t) => {
t.equal(arr.length, 10)
t.end()
})
test('position 6 is gone', (t) => {
t.equal(arr.get(6), undefined)
t.end()
})
test('can still get position 9', (t) => {
t.equal(arr.get(9), 'v9')
t.end()
})
test('delete 9th position', (t) => {
arr.unset(9)
t.end()
})
test('can not get position 9', (t) => {
t.equal(arr.get(9), undefined)
t.end()
})
test('length is now 0', (t) => {
t.equal(arr.length, 0)
t.end()
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc