bucketify v1.0.1-0
Bucketify
Bucketify is a JavaScript data manipulator that divides across a set of buckets of equal size.
Installation
Node.js
npm install --save bucketifyBrowser
Download the minified browser version bucketify.min.js
<script src="bucketify.min.js"></script>API
Bucketify({list,getProperty,minRange,maxRange,maxBuckets,bucketSize)
list: Array of number, strings, objects, etc. to be groupedgetProperty: (Optional iflistelements are numbers) A function that, when passed an element fromlist, returns a number.minRange: (Optional) The minimum value for a bucket to accept. Will be overwritten iflistcontains values less thanminRange.maxRange: (Optional) The maximum value for a bucket to accept. Will be overwritten iflistcontains values greater thanmaxRange.maxBuckets: (Optional) The maximum number of buckets. If set,maxBucketsmust be greater than zero. Cannot be set along withbucketSize.bucketSize: (Optional) The size of each bucket. If set,bucketSizemust be greater than zero. Cannot be set along withmaxBuckets.
Bucketify.add(element)
element: Element to be added to Bucketify instance
License
ISC License (ISC)
Copyright 2020 Vinay Pillai
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. THE SOFTWARE.