Previously, when the method was invoked with a string consisting of space
characters and at least one of them was a Unicode space separator (code
point above 127) it returned invalid string value with non-zero size
but zero length.
The fix is to update the size of the resulting string appropriately.
This closes #569 issue on Github.
for ( ;; ) {
if (start == prev) {
+ end = prev;
break;
}
{ njs_str("' абв '.trimStart().trimEnd()"),
njs_str("абв") },
+ { njs_str("["
+ " String.fromCodePoint(0x2028),"
+ " String.fromCodePoint(0x20, 0x2028),"
+ " String.fromCodePoint(0x0009, 0x20, 0x2028),"
+ " String.fromCodePoint(0xFEFF),"
+ "].every(v => v.trimEnd() == '')"),
+ njs_str("true") },
+
{ njs_str("'\\u2029abc\\uFEFF\\u2028'.trim()"),
njs_str("abc") },