code: function listToObject(list, key) {
          var length, result, i, obj, keyValue;
          if (!list) {
              list = [];
          }
          length = list.length;
          result = { valids: {}, discarded: [] };
          for (i = 0; i < length; i += 1) {
              obj = list[i];
              keyValue = obj[key];
              // discard the object without a key
              if (keyValue) {
                  result.valids[keyValue] = obj;
              } else {
                  result.discarded.push(obj);
              }
          }
          return result;
      }
docs: Convert a list to an object using the given key name