Knapsack
Knapsack is a module for resource allocation solving. See wiki page for more details.
Installation
npm install knapsack-js
Usage
var knapsack = ; var items = "pear": 1 "apple": 7 "grape": 0 "banana": 2 "orange": "NA" "strawberry": 4 "mandarin": null "durian": 1 "peach": undefined {} ; knapsack;// [ { strawberry: 4 }, { pear: 1 } ] knapsack;// [ { pear: 1 } ] knapsack;// [ { apple: 7 } ] knapsack;/*[ { apple: 7 }, { strawberry: 4 }, { banana: 2 }, { pear: 1 }, { durian: 1 } ]*/
License
Licensed under The MIT License (MIT)
For the full copyright and license information, please view the LICENSE.txt file.