This variant of getVersion() differs as it allows
for undefined values to be returned.
@param {Object} obj The state.map object
@param {Object} obj.metadata The state.map.metadata object
@param {string} key One of 'bnd:layer-version', 'bnd:source-version', or 'bnd:data-version'.

@returns {(number|undefined)} The version number of the given metadata key.
function getVersion(obj, key) {
  if (obj.metadata === undefined) {
    return undefined;
  }
  return obj.metadata[key];
}