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

@tangle/strategy

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tangle/strategy - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

28

index.js

@@ -5,3 +5,3 @@ const Validator = require('is-my-json-valid')

const Concat = require('./concat')
const Merge = require('./merge')
const { Merge, IsConflict, IsValidMerge } = require('./merge')
const isValidStrategy = require('./is-valid-strategy')

@@ -49,4 +49,4 @@ const map = require('./map')

this.merge = Merge(composition)
this.isConflict = this.IsConflict(composition)
this.isValidMerge = this.IsValidMerge(composition)
this.isConflict = IsConflict(composition)
this.isValidMerge = IsValidMerge(composition)
}

@@ -61,22 +61,6 @@

// mapToPure
IsConflict (composition) {
return function (graph, tipIds) {
// graph = a graph containing nodeIds, transforms, previous, and history
// tipIds = the tips of branches in the graph that may be conflicting
return Object.entries(composition).some(([field, strategy]) => {
return strategy.isConflict(graph, tipIds, field)
})
}
}
// merge
// isConflict
// isValidMerge
IsValidMerge (composition) {
return function (graph, tipId) {
// graph = a graph containing nodeIds, transforms, previous, and history
// tipId = the merge node
return Object.entries(composition).every(([field, strategy]) => {
return strategy.isValidMerge(graph, tipId, field)
})
}
}
/* Getters */

@@ -83,0 +67,0 @@ get fields () { return Object.keys(this._composition).sort() }

@@ -1,11 +0,33 @@

module.exports = function Merge (composition) {
// composition is an Object made up of several strategy
module.exports = {
Merge (composition) {
// composition is an Object made up of several strategy
return function (graph, tipId) {
const c = {}
Object.entries(composition).forEach(([field, strategy]) => {
c[field] = strategy.merge(graph, tipId, field)
})
return c
return function merge (graph, tipId) {
const c = {}
Object.entries(composition).forEach(([field, strategy]) => {
c[field] = strategy.merge(graph, tipId, field)
})
return c
}
},
IsConflict (composition) {
return function isConflict (graph, tipIds) {
// graph = a graph containing nodeIds, transforms, previous, and history
// tipIds = the tips of branches in the graph that may be conflicting
return Object.entries(composition).some(([field, strategy]) => {
return strategy.isConflict(graph, tipIds, field)
})
}
},
IsValidMerge (composition) {
return function isValidMerge (graph, tipId) {
// graph = a graph containing nodeIds, transforms, previous, and history
// tipId = the merge node
return Object.entries(composition).every(([field, strategy]) => {
return strategy.isValidMerge(graph, tipId, field)
})
}
}
}
{
"name": "@tangle/strategy",
"version": "3.0.0",
"version": "3.0.1",
"description": "a toolkit for composing tangle reducing strategies",

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

@@ -34,2 +34,3 @@ # @tangle/strategy

}
const T2 = {

@@ -36,0 +37,0 @@ title: { set: 'Brunch at Mixs' },

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