{"version":3,"file":"currency.cjs","sourceRoot":"","sources":["../src/currency.ts"],"names":[],"mappings":";;;AACA,uDAAgE;AAEhE;;;;;;;GAOG;AACH,SAAgB,QAAQ,CACtB,MAAa;IAEb,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IAEvC,OAAO,IAAA,oBAAM,EAAC,IAAA,qBAAO,EAAC,SAAS,CAAC,EAAE,IAAA,qBAAO,EAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE;QACzE,OAAO,IAAA,oBAAM,EAAC,KAAK,CAAC,WAAW,EAAE,EAAE,IAAA,qBAAO,EAAC,SAAS,CAAC,CAAC,CAAC;IACzD,CAAC,CAAgD,CAAC;AACpD,CAAC;AARD,4BAQC","sourcesContent":["import type { Struct } from '@metamask/superstruct';\nimport { coerce, create, literal } from '@metamask/superstruct';\n\n/**\n * A wrapper of Superstruct's `literal` struct that accepts a value in either\n * completely lowercase or completely uppercase (i.e., \"usd\" or \"USD\").\n *\n * @param string - The currency symbol.\n * @returns The struct that accepts the currency symbol in either case. It will\n * return the currency symbol in lowercase.\n */\nexport function currency<Value extends string>(\n  string: Value,\n): Struct<Lowercase<Value> | Uppercase<Value>> {\n  const lowerCase = string.toLowerCase();\n\n  return coerce(literal(lowerCase), literal(string.toUpperCase()), (value) => {\n    return create(value.toLowerCase(), literal(lowerCase));\n  }) as Struct<Lowercase<Value> | Uppercase<Value>>;\n}\n"]}