{
	"name": "functional-red-black-tree",
	"versions": {
		"0.0.0": {
			"name": "functional-red-black-tree",
			"version": "0.0.0",
			"description": "A fully persistent balanced binary search tree",
			"main": "rbtree.js",
			"directories": {
				"test": "test"
			},
			"dependencies": {},
			"devDependencies": {
				"iota-array": "~0.0.1",
				"tape": "~1.1.1",
				"tap": "~0.4.4"
			},
			"scripts": {
				"test": "tap test/*.js"
			},
			"repository": {
				"type": "git",
				"url": "git://github.com/mikolalysenko/functional-red-black-tree.git"
			},
			"keywords": [
				"functional",
				"red",
				"black",
				"tree",
				"binary",
				"search",
				"balance",
				"persistent",
				"fully",
				"dynamic",
				"data",
				"structure"
			],
			"author": {
				"name": "Mikola Lysenko"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/mikolalysenko/functional-red-black-tree/issues"
			},
			"_id": "functional-red-black-tree@0.0.0",
			"dist": {
				"shasum": "f94990566879919ff7c2b8872668fbf892ee8484",
				"tarball": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-0.0.0.tgz"
			},
			"_from": ".",
			"_npmVersion": "1.3.8",
			"_npmUser": {
				"name": "mikolalysenko",
				"email": "mikolalysenko@gmail.com"
			},
			"maintainers": [
				{
					"name": "mikolalysenko",
					"email": "mikolalysenko@gmail.com"
				}
			],
			"contributors": []
		},
		"1.0.0": {
			"name": "functional-red-black-tree",
			"version": "1.0.0",
			"description": "A fully persistent balanced binary search tree",
			"main": "rbtree.js",
			"directories": {
				"test": "test"
			},
			"dependencies": {},
			"devDependencies": {
				"iota-array": "^0.0.1",
				"tape": "^2.12.0"
			},
			"scripts": {
				"test": "tape test/*.js"
			},
			"repository": {
				"type": "git",
				"url": "git://github.com/mikolalysenko/functional-red-black-tree.git"
			},
			"keywords": [
				"functional",
				"red",
				"black",
				"tree",
				"binary",
				"search",
				"balance",
				"persistent",
				"fully",
				"dynamic",
				"data",
				"structure"
			],
			"author": {
				"name": "Mikola Lysenko"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/mikolalysenko/functional-red-black-tree/issues"
			},
			"homepage": "https://github.com/mikolalysenko/functional-red-black-tree",
			"_id": "functional-red-black-tree@1.0.0",
			"dist": {
				"shasum": "5fddcc1e845c7f46a1be448ea2aa8388818e1bf5",
				"tarball": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.0.tgz"
			},
			"_from": ".",
			"_npmVersion": "1.4.3",
			"_npmUser": {
				"name": "mikolalysenko",
				"email": "mikolalysenko@gmail.com"
			},
			"maintainers": [
				{
					"name": "mikolalysenko",
					"email": "mikolalysenko@gmail.com"
				}
			],
			"contributors": []
		},
		"1.0.1": {
			"name": "functional-red-black-tree",
			"version": "1.0.1",
			"description": "A fully persistent balanced binary search tree",
			"main": "rbtree.js",
			"directories": {
				"test": "test"
			},
			"dependencies": {},
			"devDependencies": {
				"iota-array": "^0.0.1",
				"tape": "^2.12.0"
			},
			"scripts": {
				"test": "tape test/*.js"
			},
			"repository": {
				"type": "git",
				"url": "git://github.com/mikolalysenko/functional-red-black-tree.git"
			},
			"keywords": [
				"functional",
				"red",
				"black",
				"tree",
				"binary",
				"search",
				"balance",
				"persistent",
				"fully",
				"dynamic",
				"data",
				"structure"
			],
			"author": {
				"name": "Mikola Lysenko"
			},
			"license": "MIT",
			"bugs": {
				"url": "https://github.com/mikolalysenko/functional-red-black-tree/issues"
			},
			"homepage": "https://github.com/mikolalysenko/functional-red-black-tree",
			"_id": "functional-red-black-tree@1.0.1",
			"dist": {
				"shasum": "1b0ab3bd553b2a0d6399d29c0e3ea0b252078327",
				"tarball": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz"
			},
			"_from": ".",
			"_npmVersion": "1.4.3",
			"_npmUser": {
				"name": "mikolalysenko",
				"email": "mikolalysenko@gmail.com"
			},
			"maintainers": [
				{
					"name": "mikolalysenko",
					"email": "mikolalysenko@gmail.com"
				}
			],
			"contributors": []
		}
	},
	"time": {
		"modified": "2018-03-07T09:53:56.382Z",
		"created": "2013-11-02T20:20:13.440Z",
		"0.0.0": "2013-11-02T20:20:14.706Z",
		"1.0.0": "2014-03-30T02:04:43.767Z",
		"1.0.1": "2014-09-29T16:05:12.335Z"
	},
	"users": {},
	"dist-tags": {
		"latest": "1.0.1"
	},
	"_uplinks": {
		"npmjs": {
			"etag": "W/\"1d15451820d9896655d4bd775230f61e\"",
			"fetched": 1602009370930
		}
	},
	"_distfiles": {
		"functional-red-black-tree-0.0.0.tgz": {
			"url": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-0.0.0.tgz",
			"sha": "f94990566879919ff7c2b8872668fbf892ee8484",
			"registry": "npmjs"
		},
		"functional-red-black-tree-1.0.0.tgz": {
			"url": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.0.tgz",
			"sha": "5fddcc1e845c7f46a1be448ea2aa8388818e1bf5",
			"registry": "npmjs"
		},
		"functional-red-black-tree-1.0.1.tgz": {
			"url": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
			"sha": "1b0ab3bd553b2a0d6399d29c0e3ea0b252078327",
			"registry": "npmjs"
		}
	},
	"_attachments": {
		"functional-red-black-tree-1.0.1.tgz": {
			"shasum": "1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
		}
	},
	"_rev": "17-a3d217d385629f94",
	"_id": "functional-red-black-tree",
	"readme": "functional-red-black-tree\n=========================\nA [fully persistent](http://en.wikipedia.org/wiki/Persistent_data_structure) [red-black tree](http://en.wikipedia.org/wiki/Red%E2%80%93black_tree) written 100% in JavaScript.  Works both in node.js and in the browser via [browserify](http://browserify.org/).\n\nFunctional (or fully presistent) data structures allow for non-destructive updates.  So if you insert an element into the tree, it returns a new tree with the inserted element rather than destructively updating the existing tree in place.  Doing this requires using extra memory, and if one were naive it could cost as much as reallocating the entire tree.  Instead, this data structure saves some memory by recycling references to previously allocated subtrees.  This requires using only O(log(n)) additional memory per update instead of a full O(n) copy.\n\nSome advantages of this is that it is possible to apply insertions and removals to the tree while still iterating over previous versions of the tree.  Functional and persistent data structures can also be useful in many geometric algorithms like point location within triangulations or ray queries, and can be used to analyze the history of executing various algorithms.  This added power though comes at a cost, since it is generally a bit slower to use a functional data structure than an imperative version.  However, if your application needs this behavior then you may consider using this module.\n\n# Install\n\n    npm install functional-red-black-tree\n\n# Example\n\nHere is an example of some basic usage:\n\n```javascript\n//Load the library\nvar createTree = require(\"functional-red-black-tree\")\n\n//Create a tree\nvar t1 = createTree()\n\n//Insert some items into the tree\nvar t2 = t1.insert(1, \"foo\")\nvar t3 = t2.insert(2, \"bar\")\n\n//Remove something\nvar t4 = t3.remove(1)\n```\n\n\n# API\n\n```javascript\nvar createTree = require(\"functional-red-black-tree\")\n```\n\n## Overview\n\n- [Tree methods](#tree-methods)\n  - [`var tree = createTree([compare])`](#var-tree-=-createtreecompare)\n  - [`tree.keys`](#treekeys)\n  - [`tree.values`](#treevalues)\n  - [`tree.length`](#treelength)\n  - [`tree.get(key)`](#treegetkey)\n  - [`tree.insert(key, value)`](#treeinsertkey-value)\n  - [`tree.remove(key)`](#treeremovekey)\n  - [`tree.find(key)`](#treefindkey)\n  - [`tree.ge(key)`](#treegekey)\n  - [`tree.gt(key)`](#treegtkey)\n  - [`tree.lt(key)`](#treeltkey)\n  - [`tree.le(key)`](#treelekey)\n  - [`tree.at(position)`](#treeatposition)\n  - [`tree.begin`](#treebegin)\n  - [`tree.end`](#treeend)\n  - [`tree.forEach(visitor(key,value)[, lo[, hi]])`](#treeforEachvisitorkeyvalue-lo-hi)\n  - [`tree.root`](#treeroot)\n- [Node properties](#node-properties)\n  - [`node.key`](#nodekey)\n  - [`node.value`](#nodevalue)\n  - [`node.left`](#nodeleft)\n  - [`node.right`](#noderight)\n- [Iterator methods](#iterator-methods)\n  - [`iter.key`](#iterkey)\n  - [`iter.value`](#itervalue)\n  - [`iter.node`](#iternode)\n  - [`iter.tree`](#itertree)\n  - [`iter.index`](#iterindex)\n  - [`iter.valid`](#itervalid)\n  - [`iter.clone()`](#iterclone)\n  - [`iter.remove()`](#iterremove)\n  - [`iter.update(value)`](#iterupdatevalue)\n  - [`iter.next()`](#iternext)\n  - [`iter.prev()`](#iterprev)\n  - [`iter.hasNext`](#iterhasnext)\n  - [`iter.hasPrev`](#iterhasprev)\n\n## Tree methods\n\n### `var tree = createTree([compare])`\nCreates an empty functional tree\n\n* `compare` is an optional comparison function, same semantics as array.sort()\n\n**Returns** An empty tree ordered by `compare`\n\n### `tree.keys`\nA sorted array of all the keys in the tree\n\n### `tree.values`\nAn array array of all the values in the tree\n\n### `tree.length`\nThe number of items in the tree\n\n### `tree.get(key)`\nRetrieves the value associated to the given key\n\n* `key` is the key of the item to look up\n\n**Returns** The value of the first node associated to `key`\n\n### `tree.insert(key, value)`\nCreates a new tree with the new pair inserted.\n\n* `key` is the key of the item to insert\n* `value` is the value of the item to insert\n\n**Returns** A new tree with `key` and `value` inserted\n\n### `tree.remove(key)`\nRemoves the first item with `key` in the tree\n\n* `key` is the key of the item to remove\n\n**Returns** A new tree with the given item removed if it exists\n\n### `tree.find(key)`\nReturns an iterator pointing to the first item in the tree with `key`, otherwise `null`.\n\n### `tree.ge(key)`\nFind the first item in the tree whose key is `>= key`\n\n* `key` is the key to search for\n\n**Returns** An iterator at the given element.\n\n### `tree.gt(key)`\nFinds the first item in the tree whose key is `> key`\n\n* `key` is the key to search for\n\n**Returns** An iterator at the given element\n\n### `tree.lt(key)`\nFinds the last item in the tree whose key is `< key`\n\n* `key` is the key to search for\n\n**Returns** An iterator at the given element\n\n### `tree.le(key)`\nFinds the last item in the tree whose key is `<= key`\n\n* `key` is the key to search for\n\n**Returns** An iterator at the given element\n\n### `tree.at(position)`\nFinds an iterator starting at the given element\n\n* `position` is the index at which the iterator gets created\n\n**Returns** An iterator starting at position\n\n### `tree.begin`\nAn iterator pointing to the first element in the tree\n\n### `tree.end`\nAn iterator pointing to the last element in the tree\n\n### `tree.forEach(visitor(key,value)[, lo[, hi]])`\nWalks a visitor function over the nodes of the tree in order.\n\n* `visitor(key,value)` is a callback that gets executed on each node.  If a truthy value is returned from the visitor, then iteration is stopped.\n* `lo` is an optional start of the range to visit (inclusive)\n* `hi` is an optional end of the range to visit (non-inclusive)\n\n**Returns** The last value returned by the callback\n\n### `tree.root`\nReturns the root node of the tree\n\n\n## Node properties\nEach node of the tree has the following properties:\n\n### `node.key`\nThe key associated to the node\n\n### `node.value`\nThe value associated to the node\n\n### `node.left`\nThe left subtree of the node\n\n### `node.right`\nThe right subtree of the node\n\n## Iterator methods\n\n### `iter.key`\nThe key of the item referenced by the iterator\n\n### `iter.value`\nThe value of the item referenced by the iterator\n\n### `iter.node`\nThe value of the node at the iterator's current position.  `null` is iterator is node valid.\n\n### `iter.tree`\nThe tree associated to the iterator\n\n### `iter.index`\nReturns the position of this iterator in the sequence.\n\n### `iter.valid`\nChecks if the iterator is valid\n\n### `iter.clone()`\nMakes a copy of the iterator\n\n### `iter.remove()`\nRemoves the item at the position of the iterator\n\n**Returns** A new binary search tree with `iter`'s item removed\n\n### `iter.update(value)`\nUpdates the value of the node in the tree at this iterator\n\n**Returns** A new binary search tree with the corresponding node updated\n\n### `iter.next()`\nAdvances the iterator to the next position\n\n### `iter.prev()`\nMoves the iterator backward one element\n\n### `iter.hasNext`\nIf true, then the iterator is not at the end of the sequence\n\n### `iter.hasPrev`\nIf true, then the iterator is not at the beginning of the sequence\n\n# Credits\n(c) 2013 Mikola Lysenko. MIT License"
}