{"version":3,"file":"_httpParameterReadNumber.mjs","names":[],"sources":["../../src/internal/_httpParameterReadNumber.ts"],"sourcesContent":["/**\n * Read one path parameter as a number.\n *\n * `null` is null, blank text is kept as text so the assertion rejects it, and\n * other text is converted when it is a number.\n *\n * @evidence contracts/common.md#principled-implementation The text `null` is null, blank text stays text so the assertion rejects it, and other text is converted when it is a number and kept as text otherwise.\n * @evidence contracts/common.md#clear-and-simple-design One conditional and one private converter.\n * @evidence contracts/common.md#prohibited-implementation-shortcuts The blank rule follows the cited issue.\n * @evidence contracts/common.md#meaningful-documentation A comment states the cases.\n */\nexport const _httpParameterReadNumber = (value: string) =>\n  value !== \"null\" ? toNumber(value) : null;\n\nconst toNumber = (str: string): number | string => {\n  // Blank text stays text, so the assertion rejects it: `Number(\" \")` is 0,\n  // which read a blank path segment as a real zero (#2448).\n  if (str.trim().length === 0) return str;\n  const value: number = Number(str);\n  return isNaN(value) ? str : value;\n};\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,4BAA4B,UACvC,UAAU,SAAS,SAAS,KAAK,IAAI;AAEvC,MAAM,YAAY,QAAiC;CAGjD,IAAI,IAAI,KAAK,CAAC,CAAC,WAAW,GAAG,OAAO;CACpC,MAAM,QAAgB,OAAO,GAAG;CAChC,OAAO,MAAM,KAAK,IAAI,MAAM;AAC9B"}