function incrementingRunsFrom(list) {
        list = list.concat([Infinity]);// use Infinity to ensure any nontrivial (length >= 2) run ends before the end of the loop
        var runs = [];
        var start = null;
        var prev = null;
        for (var i = 0; i < list.length; i++) {
            var current = list[i];
            if (start === null) {
                // first element starts a trivial run
                start = current;
            } else if (prev + 1 !== current) {
                // run ended
                if (start !== prev) {
                    // run is nontrivial
                    runs.push([start, prev]);
                }
                // start new run
                start = current;
            }
            // else: the run continues

            prev = current;
        }
        return runs;
    }
Given a sorted array of integers, this finds all contiguous runs where each item is incremented by 1 from the next.
For example:
     [0, 2, 3, 5] has one such run: [2, 3]
     [0, 2, 3, 4, 6, 8, 9, 11] has two such runs: [2, 3, 4], [8, 9]
     [0, 2, 4] has no runs.
@param {integer[]} list Sorted array of integers
@returns {Array.<Array.<integer>>} Array of pairs of start and end values of runs