npm.io
1.0.1 • Published 10 years ago

array-to-btree-object

Licence
ISC
Version
1.0.1
Deps
1
Vulns
0
Weekly
0

array-to-btree-object

This module takes a list and a comparison function, and returns an object that looks kinda like this:


{
  data: 'the-item-in-your-list',
  left: {
    data: 'another-item-in-your-list'
  },
  right: {
    data: 'another-item'
  }
}

The comparison function looks kinda like this:


function (item, treeItem) {
   return item > treeItem;
}

Keywords