packages/api/src/routes/metaplex-upload.js
/**
 * Returns the value of the tag with a given name, throwing if it's not present or has a
 * non-string value.
 *
 * @param {Record<string, string>} tags a string map of tag names to values
 * @param {string} name the name of the tag we want
 * @param {string} [alternateName] an alternate name to try (only if preferred name is not present)
 *
 * @returns {string} the tag value
 * @throws {ErrorInvalidMetaplexToken} if no tag with the given name exists in tags object, or if a tag exists with a non-string value
 */
Returns the value of the tag with a given name, throwing if it's not present or has a
non-string value.

@param {Record} tags a string map of tag names to values
@param {string} name the name of the tag we want
@param {string} [alternateName] an alternate name to try (only if preferred name is not present)

@returns {string} the tag value
@throws {ErrorInvalidMetaplexToken} if no tag with the given name exists in tags object, or if a tag exists with a non-string value
Returns the value of the tag with a given name throwing if it ' s not present or has a non - string value . @param { Record } tags a string map of tag names to values @param { string } name the name of the tag we want @param { string } [ alternateName ] an alternate name to try ( only if preferred name is not present ) @returns { string } the tag value @throws { ErrorInvalidMetaplexToken } if no tag with the given name exists in tags object or if a tag exists with a non - string value
function requiredTag(tags, name, alternateName) {
  let value = stringOrNothing(tags, name)
  if (value == null && alternateName) {
    value = stringOrNothing(tags, alternateName)
  }
  if (value == null) {
    throw new ErrorInvalidMetaplexToken(`"${name}" tag not present in payload`)
  }
  return value
}
function requiredTag ( tags , name , alternateName ) { let value = stringOrNothing ( tags , name ) if ( value == null && alternateName ) { value = stringOrNothing ( tags , alternateName ) } if ( value == null ) { throw new ErrorInvalidMetaplexToken ( ` ${ name } ` ) } return value }
Returns the value of the tag with a given name, throwing if it's not present or has a
 non-string value.
Returns the value of the tag with a given name throwing if it ' s not present or has a non - string value .