mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
js: Simplify indexing arrays from the end with Array#at.
https://github.com/tc39/proposal-relative-indexing-method Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
0b03628324
commit
c6b372b471
@@ -209,18 +209,18 @@ export function process_fenced_code(content) {
|
||||
handler_stack.push(current_handler);
|
||||
|
||||
for (const line of input) {
|
||||
const handler = handler_stack[handler_stack.length - 1];
|
||||
const handler = handler_stack.at(-1);
|
||||
handler.handle_line(line);
|
||||
}
|
||||
|
||||
// Clean up all trailing blocks by letting them
|
||||
// insert closing fences
|
||||
while (handler_stack.length !== 0) {
|
||||
const handler = handler_stack[handler_stack.length - 1];
|
||||
const handler = handler_stack.at(-1);
|
||||
handler.done();
|
||||
}
|
||||
|
||||
if (output.length > 2 && output[output.length - 2] !== "") {
|
||||
if (output.length > 2 && output.at(-2) !== "") {
|
||||
output.push("");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user