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

version-tree

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

version-tree

Version tracking data structure

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

version-tree

A data structure for maintaining a tree of versions. This can be useful when implementing fully persistent data structures using the DTSS method. Works in both node.js and browserify. All operations use amortized O(1) space and time.

Example

var createVersionTree = require("version-tree")

//Create a new tree
var root = createVersionTree()

//Create two subversions
var a = root.fork()
var b = root.fork()

//Compare root to children
console.log(root.subversion(a), root.subversion(b), a.subversion(root), b.subversion(a))
// Prints out:
//  true    true    false   false


//Make a child version of a
var c = a.fork()
console.log(root.subversion(c), a.subvsersion(c), b.subversion(c))
//Prints out:
//    true    true    false

Install

npm install version-tree

API

var createVersionTree = require("version-tree")

var tree = createVersionTree()

Creates a new version tree with one root version

tree.fork()

Creates a new subversion of tree.

Returns A new version which inherits from tree

tree.subversion(other)

Tests if other is a subversion of tree.

Returns true if other is an ancestor of tree, false otherwise

Credits

(c) 2013 Mikola Lysenko. MIT License

Keywords

FAQs

Package last updated on 29 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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