Commit 3e14690
CLJS-1304: Behavior of c.string/replace differs from Clojure
JavaScript own's `String.prototype.replace` knows how to do string
replacement using functions, therefore is used as internal
implementation. But the signature differs as the js version feeds the
matched groups as variadic arguements to the replacement function. The
solution here is to create a "function adapter" between the js replace
and the replacement function.
For cases where we have a single matching string without any subgroup,
we pass it directly, without the wrapping vector.1 parent 8b7177a commit 3e14690
File tree
2 files changed
+19
-2
lines changed- src
- main/cljs/clojure
- test/cljs/clojure
2 files changed
+19
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
27 | 39 | | |
28 | 40 | | |
29 | 41 | | |
| |||
36 | 48 | | |
37 | 49 | | |
38 | 50 | | |
39 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
40 | 54 | | |
41 | 55 | | |
42 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
0 commit comments