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

@matrixai/db

Package Overview
Dependencies
Maintainers
4
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@matrixai/db - npm Package Compare versions

Comparing version 4.0.2 to 4.0.4

3

dist/DB.js

@@ -282,4 +282,3 @@ "use strict";

if (options_.lt == null && options_.lte == null) {
const levelKeyStart = utils.levelPathToKey(levelPath);
const levelKeyEnd = Buffer.from(levelKeyStart);
const levelKeyEnd = utils.levelPathToKey(levelPath);
levelKeyEnd[levelKeyEnd.length - 1] += 1;

@@ -286,0 +285,0 @@ options_.lt = levelKeyEnd;

@@ -5,4 +5,3 @@ /// <reference types="node" />

* Separator is a single null byte
* During iteration acquiring a sublevel requires iterating
* between 0x00 and 0x01
* This special symbol must not appear in the encoded parts
*/

@@ -12,2 +11,3 @@ declare const sep: Buffer;

* Encode level or key part using base 128 encoding
* Empty parts are encoded with the special empty symbol
*/

@@ -17,2 +17,3 @@ declare function encodePart(part: Buffer): Buffer;

* Decode level or key part from base 128
* The special empty symbol is decoded as an empty buffer
*/

@@ -46,3 +47,3 @@ declare function decodePart(data: Buffer): Buffer;

* levels => level:l levels:ls -> [l, ...ls] | '' -> []
* level => sep .*?:l (?<!escape) sep (?>.*) -> l
* level => sep .*?:l sep -> l
* sep => 0x00

@@ -49,0 +50,0 @@ * keyActual => .*:k -> [k]

@@ -30,17 +30,25 @@ "use strict";

* Separator is a single null byte
* During iteration acquiring a sublevel requires iterating
* between 0x00 and 0x01
* This special symbol must not appear in the encoded parts
*/
const sep = Buffer.from([0]);
const sep = Buffer.from([0x00]);
exports.sep = sep;
/**
* Empty parts will be encoded as a single 0x01 byte
*/
const empty = Buffer.from([0x01]);
/**
* Lexicographically ordered base 128 alphabet
* The alphabet starts at 0x02 (skipping 0x00 and 0x01)
*/
const alphabet = Buffer.from(Array.from({ length: 128 }, (_, i) => {
return i + 1;
return i + 2;
}));
/**
* Encode level or key part using base 128 encoding
* Empty parts are encoded with the special empty symbol
*/
function encodePart(part) {
if (part.byteLength === 0) {
return empty;
}
// Start encoding

@@ -70,4 +78,8 @@ const mask = (1 << 7) - 1;

* Decode level or key part from base 128
* The special empty symbol is decoded as an empty buffer
*/
function decodePart(data) {
if (data.equals(empty)) {
return Buffer.allocUnsafe(0);
}
const codes = {};

@@ -154,3 +166,3 @@ for (let i = 0; i < alphabet.length; ++i) {

* levels => level:l levels:ls -> [l, ...ls] | '' -> []
* level => sep .*?:l (?<!escape) sep (?>.*) -> l
* level => sep .*?:l sep -> l
* sep => 0x00

@@ -157,0 +169,0 @@ * keyActual => .*:k -> [k]

{
"name": "@matrixai/db",
"version": "4.0.2",
"version": "4.0.4",
"author": "Roger Qiu",

@@ -5,0 +5,0 @@ "description": "DB",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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