UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

1 lines 3.82 kB
{"version":3,"sources":["../../../../../../../src/lib/utils/application-commands/compute-differences/option/minMaxValue.ts"],"names":[],"mappings":";;;;;;AAEO,UAAU,wBAAyB,CAAA;AAAA,EACzC,YAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA;AACD,CAKiC,EAAA;AAEhC,EAAA,IAAI,cAAe,CAAA,SAAA,KAAc,MAAa,IAAA,cAAA,CAAe,cAAc,MAAW,EAAA;AACrF,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,UAAA,CAAA;AAAA,MAC7B,QAAU,EAAA,mBAAA;AAAA,MACV,QAAU,EAAA;AAAA,KACX;AAAA,aAGQ,cAAe,CAAA,SAAA,KAAc,MAAa,IAAA,cAAA,CAAe,cAAc,MAAW,EAAA;AAC1F,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,UAAA,CAAA;AAAA,MAC7B,QAAU,EAAA,sBAAA;AAAA,MACV,QAAU,EAAA;AAAA,KACX;AAAA,GAGQ,MAAA,IAAA,cAAA,CAAe,SAAc,KAAA,cAAA,CAAe,SAAW,EAAA;AAC/D,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,UAAA,CAAA;AAAA,MAC7B,QAAA,EAAU,MAAO,CAAA,cAAA,CAAe,SAAS,CAAA;AAAA,MACzC,QAAA,EAAU,MAAO,CAAA,cAAA,CAAe,SAAS;AAAA,KAC1C;AAAA;AAID,EAAA,IAAI,cAAe,CAAA,SAAA,KAAc,MAAa,IAAA,cAAA,CAAe,cAAc,MAAW,EAAA;AACrF,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,UAAA,CAAA;AAAA,MAC7B,QAAU,EAAA,mBAAA;AAAA,MACV,QAAU,EAAA;AAAA,KACX;AAAA,aAGQ,cAAe,CAAA,SAAA,KAAc,MAAa,IAAA,cAAA,CAAe,cAAc,MAAW,EAAA;AAC1F,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,UAAA,CAAA;AAAA,MAC7B,QAAU,EAAA,sBAAA;AAAA,MACV,QAAU,EAAA;AAAA,KACX;AAAA,GAGQ,MAAA,IAAA,cAAA,CAAe,SAAc,KAAA,cAAA,CAAe,SAAW,EAAA;AAC/D,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,UAAA,CAAA;AAAA,MAC7B,QAAA,EAAU,MAAO,CAAA,cAAA,CAAe,SAAS,CAAA;AAAA,MACzC,QAAA,EAAU,MAAO,CAAA,cAAA,CAAe,SAAS;AAAA,KAC1C;AAAA;AAEF;AA5DiB,MAAA,CAAA,wBAAA,EAAA,0BAAA,CAAA","file":"minMaxValue.cjs","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"]}