@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
1 lines • 3.03 kB
Source Map (JSON)
{"version":3,"file":"minMaxValue.cjs","names":[],"sources":["../../../../../../../src/lib/utils/application-commands/compute-differences/option/minMaxValue.ts"],"sourcesContent":["import type { APIApplicationCommandMinAndMaxValueTypes, CommandDifference } from '../_shared';\n\nexport function* handleMinMaxValueOptions({\n\tcurrentIndex,\n\texistingOption,\n\texpectedOption,\n\tkeyPath\n}: {\n\tcurrentIndex: number;\n\tkeyPath: (index: number) => string;\n\texpectedOption: APIApplicationCommandMinAndMaxValueTypes;\n\texistingOption: APIApplicationCommandMinAndMaxValueTypes;\n}): Generator<CommandDifference> {\n\t// 0. No min_value and now we have min_value\n\tif (existingOption.min_value === undefined && expectedOption.min_value !== undefined) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.min_value`,\n\t\t\texpected: 'min_value present',\n\t\t\toriginal: 'no min_value present'\n\t\t};\n\t}\n\t// 1. Have min_value and now we don't\n\telse if (existingOption.min_value !== undefined && expectedOption.min_value === undefined) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.min_value`,\n\t\t\texpected: 'no min_value present',\n\t\t\toriginal: 'min_value present'\n\t\t};\n\t}\n\t// 2. Equality check\n\telse if (existingOption.min_value !== expectedOption.min_value) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.min_value`,\n\t\t\toriginal: String(existingOption.min_value),\n\t\t\texpected: String(expectedOption.min_value)\n\t\t};\n\t}\n\n\t// 0. No max_value and now we have max_value\n\tif (existingOption.max_value === undefined && expectedOption.max_value !== undefined) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.max_value`,\n\t\t\texpected: 'max_value present',\n\t\t\toriginal: 'no max_value present'\n\t\t};\n\t}\n\t// 1. Have max_value and now we don't\n\telse if (existingOption.max_value !== undefined && expectedOption.max_value === undefined) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.max_value`,\n\t\t\texpected: 'no max_value present',\n\t\t\toriginal: 'max_value present'\n\t\t};\n\t}\n\t// 2. Equality check\n\telse if (existingOption.max_value !== expectedOption.max_value) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.max_value`,\n\t\t\toriginal: String(existingOption.max_value),\n\t\t\texpected: String(expectedOption.max_value)\n\t\t};\n\t}\n}\n"],"mappings":";;;AAEA,UAAiB,yBAAyB,EACzC,cACA,gBACA,gBACA,WAMgC;AAEhC,KAAI,eAAe,cAAc,UAAa,eAAe,cAAc,OAC1E,OAAM;EACL,KAAK,GAAG,QAAQ,aAAa,CAAC;EAC9B,UAAU;EACV,UAAU;EACV;UAGO,eAAe,cAAc,UAAa,eAAe,cAAc,OAC/E,OAAM;EACL,KAAK,GAAG,QAAQ,aAAa,CAAC;EAC9B,UAAU;EACV,UAAU;EACV;UAGO,eAAe,cAAc,eAAe,UACpD,OAAM;EACL,KAAK,GAAG,QAAQ,aAAa,CAAC;EAC9B,UAAU,OAAO,eAAe,UAAU;EAC1C,UAAU,OAAO,eAAe,UAAU;EAC1C;AAIF,KAAI,eAAe,cAAc,UAAa,eAAe,cAAc,OAC1E,OAAM;EACL,KAAK,GAAG,QAAQ,aAAa,CAAC;EAC9B,UAAU;EACV,UAAU;EACV;UAGO,eAAe,cAAc,UAAa,eAAe,cAAc,OAC/E,OAAM;EACL,KAAK,GAAG,QAAQ,aAAa,CAAC;EAC9B,UAAU;EACV,UAAU;EACV;UAGO,eAAe,cAAc,eAAe,UACpD,OAAM;EACL,KAAK,GAAG,QAAQ,aAAa,CAAC;EAC9B,UAAU,OAAO,eAAe,UAAU;EAC1C,UAAU,OAAO,eAAe,UAAU;EAC1C"}