summaryrefslogtreecommitdiff
path: root/src/eval/methods.rs
diff options
context:
space:
mode:
authordvdvgt <40773635+dvdvgt@users.noreply.github.com>2023-05-03 11:41:50 +0200
committerGitHub <noreply@github.com>2023-05-03 11:41:50 +0200
commitbe3c4d7876f11d70eab60b8c3ae6199b7fd035fe (patch)
tree6e0504361fc2f965a1448d1521f09f1382e0164a /src/eval/methods.rs
parentedc0632d8c9d7a17cc795a57de27c6b22a748158 (diff)
[Feature] Allow function as argument for string.replace (#944)
Diffstat (limited to 'src/eval/methods.rs')
-rw-r--r--src/eval/methods.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/eval/methods.rs b/src/eval/methods.rs
index 3ee4599c..6cbb846b 100644
--- a/src/eval/methods.rs
+++ b/src/eval/methods.rs
@@ -56,9 +56,9 @@ pub fn call(
"matches" => Value::Array(string.matches(args.expect("pattern")?)),
"replace" => {
let pattern = args.expect("pattern")?;
- let with = args.expect("replacement string")?;
+ let with = args.expect("string or function")?;
let count = args.named("count")?;
- Value::Str(string.replace(pattern, with, count))
+ Value::Str(string.replace(vm, pattern, with, count)?)
}
"trim" => {
let pattern = args.eat()?;