kataan 0.0.4

A high-performance JavaScript engine written in pure Rust. Library, C FFI, and CLI.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
/*---
description: replaceAll with strings, regex, and function replacers
esid: sec-string.prototype.replaceall
---*/
assert.sameValue("a-b-c".replaceAll("-", "_"), "a_b_c");
assert.sameValue("aaa".replaceAll("a", "b"), "bbb");
assert.sameValue("hello".replaceAll("l", ""), "heo");
assert.sameValue("a.b.c".replaceAll(".", "/"), "a/b/c", "literal dot not regex");
assert.sameValue("x1y2z3".replaceAll(/\d/g, "#"), "x#y#z#", "global regex");
assert.sameValue("abc".replaceAll("", "-"), "-a-b-c-", "empty string inserts between");
assert.sameValue("no match".replaceAll("xyz", "abc"), "no match");
assert.sameValue("AAA".replaceAll("A", function () { return "B"; }), "BBB", "function replacer");