UNPKG

@sapphire/framework

Version:

Discord bot framework built for advanced and amazing bots.

1 lines 985 B
{"version":3,"file":"string.mjs","names":[],"sources":["../../../../src/lib/resolvers/string.ts"],"sourcesContent":["import { Result } from '@sapphire/result';\nimport { Identifiers } from '../errors/Identifiers';\n\nexport function resolveString(\n\tparameter: string,\n\toptions?: { minimum?: number; maximum?: number }\n): Result<string, Identifiers.ArgumentStringTooShort | Identifiers.ArgumentStringTooLong> {\n\tif (typeof options?.minimum === 'number' && parameter.length < options.minimum) {\n\t\treturn Result.err(Identifiers.ArgumentStringTooShort);\n\t}\n\n\tif (typeof options?.maximum === 'number' && parameter.length > options.maximum) {\n\t\treturn Result.err(Identifiers.ArgumentStringTooLong);\n\t}\n\n\treturn Result.ok(parameter);\n}\n"],"mappings":";;;;AAGA,SAAgB,cACf,WACA,SACyF;AACzF,KAAI,OAAO,SAAS,YAAY,YAAY,UAAU,SAAS,QAAQ,QACtE,QAAO,OAAO,IAAI,YAAY,uBAAuB;AAGtD,KAAI,OAAO,SAAS,YAAY,YAAY,UAAU,SAAS,QAAQ,QACtE,QAAO,OAAO,IAAI,YAAY,sBAAsB;AAGrD,QAAO,OAAO,GAAG,UAAU"}