import { type StrNum } from "https://deno.land/x/rimbu@1.1.0/typical/index.ts";
const { Add } = StrNum;
Returns the result of adding the two given string-numbers.
Examples
Example 1
Example 1
SAdd<'13', '8'> => '21'
SAdd<'139', '5232'> => '5371'
definition: N1 extends Str.Append<infer N1Start, Digit> ? N2 extends Str.Append<infer N2Start, Digit> ? N1 extends Str.Append<N1Start, infer N1LastDigit> ? N2 extends Str.Append<N2Start, infer N2LastDigit> ? AddDigit<N1LastDigit & Digit, N2LastDigit & Digit> extends [infer NewDigit, infer Overflow] ? Overflow extends true ? [N1Start, N2Start] extends ["", ""] ? Str.Append<"1", string & NewDigit> : Str.Append<Add<Add<N1Start, N2Start>, "1">, NewDigit & string> : Str.Append<Add<N1Start, N2Start>, NewDigit & string> : never : never : never : N1 : N2