Function
replaceClose
(
index,
string,
close,
replace,
head = string.slice(0, Math.max(0, index)) + replace,
tail = string.slice(Math.max(0, index + close.length)),
next = tail.indexOf(close)
)
Source from the content-addressed store, hash-verified
| 867 | * @returns {string} result |
| 868 | */ |
| 869 | const replaceClose = ( |
| 870 | index, |
| 871 | string, |
| 872 | close, |
| 873 | replace, |
| 874 | head = string.slice(0, Math.max(0, index)) + replace, |
| 875 | tail = string.slice(Math.max(0, index + close.length)), |
| 876 | next = tail.indexOf(close) |
| 877 | ) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace)); |
| 878 | |
| 879 | /** |
| 880 | * Returns result. |
Tested by
no test coverage detected