@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
1 lines • 3.88 kB
Source Map (JSON)
{"version":3,"sources":["../../../../../../../src/lib/utils/application-commands/compute-differences/option/minMaxLength.ts"],"names":[],"mappings":";;;;;;AAGO,UAAU,yBAA0B,CAAA;AAAA,EAC1C,YAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA;AACD,CAKiC,EAAA;AAEhC,EAAA,IAAI,cAAe,CAAA,UAAA,KAAe,MAAa,IAAA,cAAA,CAAe,eAAe,MAAW,EAAA;AACvF,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,WAAA,CAAA;AAAA,MAC7B,QAAU,EAAA,oBAAA;AAAA,MACV,QAAU,EAAA;AAAA,KACX;AAAA,aAGQ,cAAe,CAAA,UAAA,KAAe,MAAa,IAAA,cAAA,CAAe,eAAe,MAAW,EAAA;AAC5F,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,WAAA,CAAA;AAAA,MAC7B,QAAU,EAAA,uBAAA;AAAA,MACV,QAAU,EAAA;AAAA,KACX;AAAA,GAGQ,MAAA,IAAA,cAAA,CAAe,UAAe,KAAA,cAAA,CAAe,UAAY,EAAA;AACjE,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,WAAA,CAAA;AAAA,MAC7B,QAAA,EAAU,MAAO,CAAA,cAAA,CAAe,UAAU,CAAA;AAAA,MAC1C,QAAA,EAAU,MAAO,CAAA,cAAA,CAAe,UAAU;AAAA,KAC3C;AAAA;AAID,EAAA,IAAI,cAAe,CAAA,UAAA,KAAe,MAAa,IAAA,cAAA,CAAe,eAAe,MAAW,EAAA;AACvF,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,WAAA,CAAA;AAAA,MAC7B,QAAU,EAAA,oBAAA;AAAA,MACV,QAAU,EAAA;AAAA,KACX;AAAA,aAGQ,cAAe,CAAA,UAAA,KAAe,MAAa,IAAA,cAAA,CAAe,eAAe,MAAW,EAAA;AAC5F,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,WAAA,CAAA;AAAA,MAC7B,QAAU,EAAA,uBAAA;AAAA,MACV,QAAU,EAAA;AAAA,KACX;AAAA,GAGQ,MAAA,IAAA,cAAA,CAAe,UAAe,KAAA,cAAA,CAAe,UAAY,EAAA;AACjE,IAAM,MAAA;AAAA,MACL,GAAK,EAAA,CAAA,EAAG,OAAQ,CAAA,YAAY,CAAC,CAAA,WAAA,CAAA;AAAA,MAC7B,QAAA,EAAU,MAAO,CAAA,cAAA,CAAe,UAAU,CAAA;AAAA,MAC1C,QAAA,EAAU,MAAO,CAAA,cAAA,CAAe,UAAU;AAAA,KAC3C;AAAA;AAEF;AA5DiB,MAAA,CAAA,yBAAA,EAAA,2BAAA,CAAA","file":"minMaxLength.cjs","sourcesContent":["import type { APIApplicationCommandStringOption } from 'discord-api-types/v10';\nimport type { CommandDifference } from '../_shared';\n\nexport function* handleMinMaxLengthOptions({\n\tcurrentIndex,\n\texistingOption,\n\texpectedOption,\n\tkeyPath\n}: {\n\tcurrentIndex: number;\n\tkeyPath: (index: number) => string;\n\texpectedOption: APIApplicationCommandStringOption;\n\texistingOption: APIApplicationCommandStringOption;\n}): Generator<CommandDifference> {\n\t// 0. No min_length and now we have min_length\n\tif (existingOption.min_length === undefined && expectedOption.min_length !== undefined) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.min_length`,\n\t\t\texpected: 'min_length present',\n\t\t\toriginal: 'no min_length present'\n\t\t};\n\t}\n\t// 1. Have min_length and now we don't\n\telse if (existingOption.min_length !== undefined && expectedOption.min_length === undefined) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.min_length`,\n\t\t\texpected: 'no min_length present',\n\t\t\toriginal: 'min_length present'\n\t\t};\n\t}\n\t// 2. Equality check\n\telse if (existingOption.min_length !== expectedOption.min_length) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.min_length`,\n\t\t\toriginal: String(existingOption.min_length),\n\t\t\texpected: String(expectedOption.min_length)\n\t\t};\n\t}\n\n\t// 0. No max_length and now we have max_length\n\tif (existingOption.max_length === undefined && expectedOption.max_length !== undefined) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.max_length`,\n\t\t\texpected: 'max_length present',\n\t\t\toriginal: 'no max_length present'\n\t\t};\n\t}\n\t// 1. Have max_length and now we don't\n\telse if (existingOption.max_length !== undefined && expectedOption.max_length === undefined) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.max_length`,\n\t\t\texpected: 'no max_length present',\n\t\t\toriginal: 'max_length present'\n\t\t};\n\t}\n\t// 2. Equality check\n\telse if (existingOption.max_length !== expectedOption.max_length) {\n\t\tyield {\n\t\t\tkey: `${keyPath(currentIndex)}.max_length`,\n\t\t\toriginal: String(existingOption.max_length),\n\t\t\texpected: String(expectedOption.max_length)\n\t\t};\n\t}\n}\n"]}