Skip to content

Commit 434b159

Browse files
committed
Add replace'
1 parent 0885075 commit 434b159

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Data/String/Regex.purs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ foreign import replace
3232
\ };\
3333
\}" :: Regex -> String -> String -> String
3434

35+
foreign import replace'
36+
"function replace$prime(r) {\
37+
\ return function(f) {\
38+
\ return function(s2) {\
39+
\ return s2.replace(r, function (match) {\
40+
\ return f(match)(Array.prototype.splice.call(arguments, 1, arguments.length - 3));\
41+
\ });\
42+
\ };\
43+
\ };\
44+
\}" :: Regex -> (String -> [String] -> String) -> String -> String
45+
3546
foreign import search
3647
"function search(r) {\
3748
\ return function (s) {\

0 commit comments

Comments
 (0)