legacyCompat.chomp(s: string): string
Perl's chomp($x) mutates $x in place, stripping exactly one trailing "\n" (Perl's
default $/ record separator — not "\r\n"). JS can't mutate a caller's local binding
through a function call, so converted code must reassign the result itself:
x = legacyCompat.chomp(x), mirroring chomp $x;'s own mutating spirit as closely as a
pure function can.