addValueToSlot(slots, sampleSlots, sampleValue, roundUp = true) {

        // set to first of the slots
        let previousSlotKey = slots[0];
        let lastSlotKey = slots[slots.length -1];

        // find the correct slot for the value
        for (const slotKey of slots) {
            if (sampleValue === slotKey) {

                // value matches slot, put it there
                sampleSlots.set(slotKey, sampleSlots.get(slotKey) + 1);
            } else if (sampleValue < slotKey) {

                // value is smaller than that before, put it in the current
                // slot if rounding up or the previous if rounding down
                const key = roundUp ? slotKey : previousSlotKey;
                sampleSlots.set(key, sampleSlots.get(key) + 1);
            } else if (slotKey === lastSlotKey) {

                // put the last value in the last slot
                sampleSlots.set(slotKey, sampleSlots.get(slotKey) + 1);
            } else {
                previousSlotKey = slotKey;
                continue;
            }

            // isn't encountered when the els statement is executed
            break;
        }
    }
/**
     * assigns a value to a given slot by mathicng it and rounding it up or down
     * if it doesn't match to a slot
     *
     * @param      {array}    slots           predefined array of slots that
     *                                        exist
     * @param      {map}      sampleSlots     the slots that store the counters
     *                                        on the matrix points
     * @param      {number}   sampleValue     the current value
     * @param      {boolean}  [roundUp=true]  round up or down?
     */
assigns a value to a given slot by mathicng it and rounding it up or down
if it doesn't match to a slot


assigns a value to a given slot by mathicng it and rounding it up or down if it doesn ' t match to a slot
addValueToSlot(slots, sampleSlots, sampleValue, roundUp = true) {
        let previousSlotKey = slots[0];
        let lastSlotKey = slots[slots.length -1];
        for (const slotKey of slots) {
            if (sampleValue === slotKey) {
                sampleSlots.set(slotKey, sampleSlots.get(slotKey) + 1);
            } else if (sampleValue < slotKey) {
                const key = roundUp ? slotKey : previousSlotKey;
                sampleSlots.set(key, sampleSlots.get(key) + 1);
            } else if (slotKey === lastSlotKey) {
                sampleSlots.set(slotKey, sampleSlots.get(slotKey) + 1);
            } else {
                previousSlotKey = slotKey;
                continue;
            }
            break;
        }
    }
addValueToSlot ( slots , sampleSlots , sampleValue , roundUp = true ) { let previousSlotKey = slots [ 0 ] ; let lastSlotKey = slots [ slots . length - 1 ] ; for ( const slotKey of slots ) { if ( sampleValue === slotKey ) { sampleSlots . set ( slotKey , sampleSlots . get ( slotKey ) + 1 ) ; } else if ( sampleValue < slotKey ) { const key = roundUp ? slotKey : previousSlotKey ; sampleSlots . set ( key , sampleSlots . get ( key ) + 1 ) ; } else if ( slotKey === lastSlotKey ) { sampleSlots . set ( slotKey , sampleSlots . get ( slotKey ) + 1 ) ; } else { previousSlotKey = slotKey ; continue ; } break ; } }
assigns a value to a given slot by mathicng it and rounding it up or down
 if it doesn't match to a slot
assigns a value to a given slot by mathicng it and rounding it up or down if it doesn ' t match to a slot
// set to first of the slots // find the correct slot for the value // value matches slot, put it there // value is smaller than that before, put it in the current // slot if rounding up or the previous if rounding down // put the last value in the last slot // isn't encountered when the els statement is executed