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

@graffy/common

Package Overview
Dependencies
Maintainers
1
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graffy/common - npm Package Compare versions

Comparing version 0.14.3 to 0.14.4

23

graph/sieve.js

@@ -99,4 +99,5 @@ "use strict";

base = _ref2[1];
}
} // Ensure node is newer than base
return (0, _filter["default"])(_context2 = [base.key < node.key && (0, _extends2["default"])({}, base, {

@@ -133,3 +134,3 @@ end: (0, _step.keyBefore)(node.key)

var range = current[index];
var newChange = getNewer(change, range.version);
var newChange = getNewer(change, range);
if (!newChange) return;

@@ -154,2 +155,3 @@ result.push(newChange);

var nextResult = [];
node.version = change.version;
sieve(node.children, change.children, nextResult);

@@ -163,3 +165,3 @@ if (nextResult.length) result.push((0, _extends2["default"])({}, change, {

// Otherwise, discard the branch and keep the change.
var newNode = getNewer(node, change.version);
var newNode = getNewer(node, change);
current[index] = newNode || change;

@@ -169,7 +171,10 @@ if (!newNode) result.push(change); // TODO: In the case of partial removal, what should result be?

// Current node is a leaf. Replace with the change if it is newer.
var newChange = getNewer(change, node.version);
var newChange = getNewer(change, node);
if (newChange) {
current[index] = newChange;
result.push(newChange);
current[index] = newChange; // console.log(current);
if (change.value !== node.value || change.path !== node.path) {
result.push(newChange);
}
}

@@ -181,3 +186,3 @@ }

function getNewer(node, version) {
function getNewer(node, base) {
if ((0, _node.isBranch)(node)) {

@@ -187,3 +192,3 @@ var _context5;

var children = (0, _filter["default"])(_context5 = node.children).call(_context5, function (child) {
return getNewer(child, version);
return getNewer(child, base);
});

@@ -195,3 +200,3 @@ return children.length && (0, _extends2["default"])({}, node, {

// assertVersion(node, version);
return node.version >= version ? node : null;
return node.version >= base.version ? node : null;
}

@@ -198,0 +203,0 @@ } // function assertVersion(node, version) {

@@ -23,2 +23,4 @@ "use strict";

var _add = _interopRequireDefault(require("./add"));
var Result =

@@ -47,3 +49,3 @@ /*#__PURE__*/

this.linked = this.linked || [];
(0, _merge["default"])(this.linked, children);
(0, _add["default"])(this.linked, children);
};

@@ -50,0 +52,0 @@

@@ -5,3 +5,3 @@ {

"author": "aravind (https://github.com/aravindet)",
"version": "0.14.3",
"version": "0.14.4",
"main": "index.js",

@@ -8,0 +8,0 @@ "source": "src/index.js",

@@ -50,2 +50,4 @@ import { isBranch, isRange, getIndex, getLastIndex } from '../node';

if (node.version < base.version) [node, base] = [base, node];
// Ensure node is newer than base
return [

@@ -78,3 +80,3 @@ base.key < node.key && { ...base, end: keyBefore(node.key) },

const range = current[index];
const newChange = getNewer(change, range.version);
const newChange = getNewer(change, range);
if (!newChange) return;

@@ -98,2 +100,3 @@ result.push(newChange);

const nextResult = [];
node.version = change.version;
sieve(node.children, change.children, nextResult);

@@ -105,3 +108,3 @@ if (nextResult.length) result.push({ ...change, children: nextResult });

// Otherwise, discard the branch and keep the change.
const newNode = getNewer(node, change.version);
const newNode = getNewer(node, change);
current[index] = newNode || change;

@@ -112,6 +115,9 @@ if (!newNode) result.push(change);

// Current node is a leaf. Replace with the change if it is newer.
const newChange = getNewer(change, node.version);
const newChange = getNewer(change, node);
if (newChange) {
current[index] = newChange;
result.push(newChange);
// console.log(current);
if (change.value !== node.value || change.path !== node.path) {
result.push(newChange);
}
}

@@ -122,9 +128,9 @@ }

function getNewer(node, version) {
function getNewer(node, base) {
if (isBranch(node)) {
const children = node.children.filter(child => getNewer(child, version));
const children = node.children.filter(child => getNewer(child, base));
return children.length && { ...node, children };
} else {
// assertVersion(node, version);
return node.version >= version ? node : null;
return node.version >= base.version ? node : null;
}

@@ -131,0 +137,0 @@ }

@@ -12,2 +12,3 @@ import {

import merge from './merge';
import add from './add';

@@ -33,3 +34,3 @@ class Result {

this.linked = this.linked || [];
merge(this.linked, children);
add(this.linked, children);
}

@@ -36,0 +37,0 @@ }

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