function keyArray(arr, keyfn) {
            var map = {};
            arr.forEach(function (o) {
                var key = keyfn(o);
                map[key] = o;
            });
            return map;
        }
******************************************************
         // Convert an array into an object.  The returned object has keys defined by the keyfn,
         // and values from the original array.  If there are duplicate keys, the resulting object
         // has the value of the last key.
         // arr: array of objects
         // keyfn: function to get the desired group key from each object
         // See utilSpec.js for an example.
*******************************************************