Commit 2e08299
Fix NULL being appended to SQL statements with no interpolations (#341)
The zip function from es-toolkit pads arrays of different lengths with
undefined. Since template literals always have one more fragment than
values, when there were no interpolated values, zip would pair the single
fragment with undefined, which then got converted to "NULL".
Extracted a processTemplateParts helper that properly handles the template
literal structure by pairing each value with its preceding fragment and
appending the final fragment separately.
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent b45a180 commit 2e08299
2 files changed
Lines changed: 32 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
45 | 67 | | |
46 | 68 | | |
47 | 69 | | |
48 | 70 | | |
49 | 71 | | |
50 | | - | |
| 72 | + | |
51 | 73 | | |
52 | 74 | | |
53 | 75 | | |
54 | 76 | | |
55 | 77 | | |
56 | 78 | | |
57 | 79 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 80 | + | |
64 | 81 | | |
65 | 82 | | |
66 | 83 | | |
| |||
126 | 143 | | |
127 | 144 | | |
128 | 145 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | 146 | | |
| 147 | + | |
133 | 148 | | |
134 | 149 | | |
135 | 150 | | |
| |||
0 commit comments