{"_id":"binary-search-tree","_rev":"209659","name":"binary-search-tree","description":"Different binary search tree implementations, including a self-balancing one (AVL)","dist-tags":{"latest":"0.2.6"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"time":{"modified":"2021-06-03T15:25:55.000Z","created":"2013-05-27T17:01:08.186Z","0.2.6":"2016-02-28T20:20:14.322Z","0.2.5":"2015-12-24T10:14:46.270Z","0.2.4":"2014-08-17T14:32:57.810Z","0.2.3":"2013-06-10T11:12:31.786Z","0.2.2":"2013-06-09T09:27:19.319Z","0.2.1":"2013-06-08T12:54:38.924Z","0.2.0":"2013-06-08T11:47:08.015Z","0.1.4":"2013-06-01T14:52:26.203Z","0.1.3":"2013-05-31T09:50:05.412Z","0.1.2":"2013-05-30T11:09:41.661Z","0.1.1":"2013-05-28T16:12:50.003Z","0.1.0":"2013-05-28T11:22:37.180Z","0.0.3":"2013-05-28T09:50:55.703Z","0.0.2":"2013-05-28T09:28:15.666Z","0.0.1":"2013-05-27T17:01:08.186Z"},"users":{"zhoutk":true,"itonyyo":true},"author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"repository":{"type":"git","url":"git+ssh://git@github.com/louischatriot/node-binary-search-tree.git"},"versions":{"0.2.6":{"name":"binary-search-tree","version":"0.2.6","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git+ssh://git@github.com/louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","gitHead":"65bf5e8471d1fa2912f2b90b88d57bd48082f004","bugs":{"url":"https://github.com/louischatriot/node-binary-search-tree/issues"},"_id":"binary-search-tree@0.2.6","_shasum":"c6d29194e286827fcffe079010e6bf77def10ce3","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"dist":{"shasum":"c6d29194e286827fcffe079010e6bf77def10ce3","size":17595,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.2.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.2.6.tgz"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/binary-search-tree-0.2.6.tgz_1456690813215_0.19540293933823705"},"directories":{},"publish_time":1456690814322,"_cnpm_publish_time":1456690814322,"_hasShrinkwrap":false},"0.2.5":{"name":"binary-search-tree","version":"0.2.5","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git+ssh://git@github.com/louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","gitHead":"4b0a43c1f2fe11ff0461441cfba9e56ab59ba28c","bugs":{"url":"https://github.com/louischatriot/node-binary-search-tree/issues"},"_id":"binary-search-tree@0.2.5","_shasum":"7dbb3b210fdca082450dad2334c304af39bdc784","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"dist":{"shasum":"7dbb3b210fdca082450dad2334c304af39bdc784","size":17468,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.2.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.2.5.tgz"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1450952086270,"_cnpm_publish_time":1450952086270,"_hasShrinkwrap":false},"0.2.4":{"name":"binary-search-tree","version":"0.2.4","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","_id":"binary-search-tree@0.2.4","dist":{"shasum":"14fe106366a59ca8efb68c0ae30c36aaff0cd510","size":17492,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.2.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.2.4.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1408285977810,"_cnpm_publish_time":1408285977810,"_hasShrinkwrap":false},"0.2.3":{"name":"binary-search-tree","version":"0.2.3","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.2.3","dist":{"shasum":"b76b362b40df435f6da165f5bd319aee36efdd76","size":17491,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.2.3.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1370862751786,"_cnpm_publish_time":1370862751786,"_hasShrinkwrap":false},"0.2.2":{"name":"binary-search-tree","version":"0.2.2","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.2.2","dist":{"shasum":"c01b56fbed954feb9735b2bc225a0ffe83977bac","size":15245,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.2.2.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1370770039319,"_cnpm_publish_time":1370770039319,"_hasShrinkwrap":false},"0.2.1":{"name":"binary-search-tree","version":"0.2.1","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.2.1","dist":{"shasum":"e2650a8ddc726e7473fff2a289f78c51861db809","size":14570,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.2.1.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1370696078924,"_cnpm_publish_time":1370696078924,"_hasShrinkwrap":false},"0.2.0":{"name":"binary-search-tree","version":"0.2.0","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.2.0","dist":{"shasum":"eebbbf9b43536b2f2bfb37c4b6e767740597d7c9","size":14080,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.2.0.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1370692028015,"_cnpm_publish_time":1370692028015,"_hasShrinkwrap":false},"0.1.4":{"name":"binary-search-tree","version":"0.1.4","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.1.4","dist":{"shasum":"dd106e5b95ca7251ae53bf77b9967c3c5196e832","size":8450,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.1.4.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1370098346203,"_cnpm_publish_time":1370098346203,"_hasShrinkwrap":false},"0.1.3":{"name":"binary-search-tree","version":"0.1.3","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.1.3","dist":{"shasum":"2d6542315736cced722d3ab7ea0e9b8dcb4822f8","size":8245,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.1.3.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1369993805412,"_cnpm_publish_time":1369993805412,"_hasShrinkwrap":false},"0.1.2":{"name":"binary-search-tree","version":"0.1.2","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.1.2","dist":{"shasum":"9092026f3470d5a0795d2a0e7ad3b188d02223b9","size":8018,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.1.2.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1369912181661,"_cnpm_publish_time":1369912181661,"_hasShrinkwrap":false},"0.1.1":{"name":"binary-search-tree","version":"0.1.1","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.1.1","dist":{"shasum":"5482d1a37bbe779cfabe256200b283ac4276d0c3","size":7966,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.1.1.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1369757570003,"_cnpm_publish_time":1369757570003,"_hasShrinkwrap":false},"0.1.0":{"name":"binary-search-tree","version":"0.1.0","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Different binary search tree implementations, including a self-balancing one (AVL)","keywords":["AVL tree","binary search tree","self-balancing","AVL tree"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.1.0","dist":{"shasum":"8944bd00073754ca1e75468103b2850477312bbb","size":7858,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.1.0.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1369740157180,"_cnpm_publish_time":1369740157180,"_hasShrinkwrap":false},"0.0.3":{"name":"binary-search-tree","version":"0.0.3","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Node.js implementation of an AVL self-balancing binary search tree","keywords":["AVL tree","binary search tree","self-balancing"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.0.3","dist":{"shasum":"de8e837c06b94ed4940b5eff39b21a2be7d7c88d","size":5880,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.0.3.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1369734655703,"_cnpm_publish_time":1369734655703,"_hasShrinkwrap":false},"0.0.2":{"name":"binary-search-tree","version":"0.0.2","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Node.js implementation of an AVL self-balancing binary search tree","keywords":["AVL tree","binary search tree","self-balancing"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.0.2","dist":{"shasum":"d77f42635b19aaf5edaba330d8d2e78c2cd2645d","size":5455,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.0.2.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1369733295666,"_cnpm_publish_time":1369733295666,"_hasShrinkwrap":false},"0.0.1":{"name":"binary-search-tree","version":"0.0.1","author":{"name":"Louis Chatriot","email":"louis.chatriot@gmail.com"},"description":"Node.js implementation of an AVL self-balancing binary search tree","keywords":["AVL tree","binary search tree","self-balancing"],"homepage":"https://github.com/louischatriot/node-binary-search-tree","repository":{"type":"git","url":"git@github.com:louischatriot/node-binary-search-tree.git"},"dependencies":{"underscore":"~1.4.4"},"devDependencies":{"chai":"1.0.x","mocha":"1.4.x"},"scripts":{"test":"make test"},"main":"index","licence":"MIT","readmeFilename":"README.md","_id":"binary-search-tree@0.0.1","dist":{"shasum":"4eed1b5c82d1783daaa4845b8840ec661e072449","size":3217,"noattachment":false,"key":"/binary-search-tree/-/binary-search-tree-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/binary-search-tree/download/binary-search-tree-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"louischatriot","email":"louis.chatriot@gmail.com"},"maintainers":[{"name":"louischatriot","email":"louis.chatriot@gmail.com"}],"directories":{},"publish_time":1369674068186,"_cnpm_publish_time":1369674068186,"_hasShrinkwrap":false}},"readme":"# Binary search trees for Node.js\n\nTwo implementations of binary search tree: <a href=\"http://en.wikipedia.org/wiki/Binary_search_tree\" target=\"_blank\">basic</a> and <a href=\"http://en.wikipedia.org/wiki/AVL_tree\" target=\"_blank\">AVL</a> (a kind of self-balancing binmary search tree). I wrote this module primarily to store indexes for <a href=\"https://github.com/louischatriot/nedb\" target=\"_blank\">NeDB</a> (a javascript dependency-less database).\n\n\n## Installation and tests\nPackage name is `binary-search-tree`.\n\n```bash\nnpm install binary-search-tree --save\n\nmake test\n```\n\n## Usage\nThe API mainly provides 3 functions: `insert`, `search` and `delete`. If you do not create a unique-type binary search tree, you can store multiple pieces of data for the same key. Doing so with a unique-type BST will result in an error being thrown. Data is always returned as an array, and you can delete all data relating to a given key, or just one piece of data.\n\nValues inserted can be anything except `undefined`.\n\n```javascript\nvar BinarySearchTree = require('binary-search-tree').BinarySearchTree\n  , AVLTree = require('binary-search-tree').AVLTree   // Same API as BinarySearchTree\n\n// Creating a binary search tree\nvar bst = new BinarySearchTree();\n\n// Inserting some data\nbst.insert(15, 'some data for key 15');\nbst.insert(12, 'something else');\nbst.insert(18, 'hello');\n\n// You can insert multiple pieces of data for the same key\n// if your tree doesn't enforce a unique constraint\nbst.insert(18, 'world');\n\n// Retrieving data (always returned as an array of all data stored for this key)\nbst.search(15);   // Equal to ['some data for key 15']\nbst.search(18);   // Equal to ['hello', 'world']\nbst.search(1);    // Equal to []\n\n// Search between bounds with a MongoDB-like query\n// Data is returned in key order\n// Note the difference between $lt (less than) and $gte (less than OR EQUAL)\nbst.betweenBounds({ $lt: 18, $gte: 12});   // Equal to ['something else', 'some data for key 15']\n\n// Deleting all the data relating to a key\nbst.delete(15);   // bst.search(15) will now give []\nbst.delete(18, 'world');   // bst.search(18) will now give ['hello']\n```\n\nThere are three optional parameters you can pass the BST constructor, allowing you to enforce a key-uniqueness constraint, use a custom function to compare keys and use a custom function to check whether values are equal. These parameters are all passed in an object.\n\n### Uniqueness\n\n```javascript\nvar bst = new BinarySearchTree({ unique: true });\nbst.insert(10, 'hello');\nbst.insert(10, 'world');   // Will throw an error\n```\n\n### Custom key comparison\n\n```javascript\n// Custom key comparison function\n// It needs to return a negative number if a is less than b,\n// a positive number if a is greater than b\n// and 0 if they are equal\n// If none is provided, the default one can compare numbers, dates and strings\n// which are the most common usecases\nfunction compareKeys (a, b) {\n  if (a.age < b.age) { return -1; }\n  if (a.age > b.age) { return 1; }\n  \n  return 0;\n}\n\n// Now we can use objects with an 'age' property as keys\nvar bst = new BinarySearchTree({ compareKeys: compareKeys });\nbst.insert({ age: 23 }, 'Mark');\nbst.insert({ age: 47 }, 'Franck');\n```\n\n### Custom value checking\n\n```javascript\n// Custom value equality checking function used when we try to just delete one piece of data\n// Returns true if a and b are considered the same, false otherwise\n// The default function is able to compare numbers and strings\nfunction checkValueEquality (a, b) {\n  return a.length === b.length;\n}\nvar bst = new BinarySearchTree({ checkValueEquality: checkValueEquality });\nbst.insert(10, 'hello');\nbst.insert(10, 'world');\nbst.insert(10, 'howdoyoudo');\n\nbst.delete(10, 'abcde');\nbst.search(10);   // Returns ['howdoyoudo']\n```\n\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2013 Louis Chatriot &lt;louis.chatriot@gmail.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_attachments":{},"homepage":"https://github.com/louischatriot/node-binary-search-tree","bugs":{"url":"https://github.com/louischatriot/node-binary-search-tree/issues"}}