Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quickbit-universal

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quickbit-universal - npm Package Compare versions

Comparing version 2.0.5 to 2.1.0

39

fallback.js

@@ -128,20 +128,21 @@ const simdle = require('simdle-universal')

const Index = exports.Index = class Index {
static from (fieldOrChunks) {
static from (fieldOrChunks, byteLength = -1) {
if (Array.isArray(fieldOrChunks)) {
return new SparseIndex(fieldOrChunks)
return new SparseIndex(fieldOrChunks, byteLength)
} else {
return new DenseIndex(fieldOrChunks)
return new DenseIndex(fieldOrChunks, byteLength)
}
}
get byteLength () {
return 0
constructor (byteLength) {
this._byteLength = byteLength
this.handle = new Uint32Array(INDEX_LEN / 4)
}
constructor () {
this.handle = new Uint32Array(INDEX_LEN / 4)
get byteLength () {
return this._byteLength
}
skipFirst (value, position = 0) {
const n = this.field.byteLength * 8
const n = this.byteLength * 8

@@ -179,4 +180,4 @@ if (position < 0) position += n

skipLast (value, position = this.field.byteLength * 8 - 1) {
const n = this.field.byteLength * 8
skipLast (value, position = this.byteLength * 8 - 1) {
const n = this.byteLength * 8

@@ -216,4 +217,4 @@ if (position < 0) position += n

class DenseIndex extends Index {
constructor (field) {
super()
constructor (field, byteLength) {
super(byteLength)
this.field = field

@@ -259,2 +260,3 @@

get byteLength () {
if (this._byteLength !== -1) return this._byteLength
return this.field.byteLength

@@ -264,3 +266,3 @@ }

update (bit) {
const n = this.field.byteLength * 8
const n = this.byteLength * 8

@@ -321,4 +323,4 @@ if (bit < 0) bit += n

class SparseIndex extends Index {
constructor (chunks) {
super()
constructor (chunks, byteLength) {
super(byteLength)
this.chunks = chunks

@@ -366,2 +368,3 @@

get byteLength () {
if (this._byteLength !== -1) return this._byteLength
const last = this.chunks[this.chunks.length - 1]

@@ -372,8 +375,4 @@ return last ? last.offset + last.field.byteLength : 0

update (bit) {
if (this.chunks.length === 0) return false
const n = this.byteLength * 8
const last = this.chunks[this.chunks.length - 1]
const n = (last.offset + last.field.byteLength) * 8
if (bit < 0) bit += n

@@ -380,0 +379,0 @@ if (bit < 0 || bit >= n) return false

{
"name": "quickbit-universal",
"version": "2.0.5",
"version": "2.1.0",
"description": "Universal wrapper for libquickbit with a JavaScript fallback",

@@ -31,3 +31,3 @@ "main": "index.js",

"optionalDependencies": {
"quickbit-native": "^2.0.3"
"quickbit-native": "^2.1.0"
},

@@ -34,0 +34,0 @@ "devDependencies": {

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