The payments team’s branch-name helper now runs in JavaScript. For PAY-2291, PAY-2304, and PAY-2317, ticket-branch.js prints what ticket_branch.py prints, apart from lowercase true and false.
You can now:
- Build text with double quotes, and with template literals when you insert a value or the text spans lines
- Read characters with brackets, or with
.at()for a negative position such as-1, and take ranges with.slice() - Clean and check text with the JavaScript counterparts of Python’s methods, such as
.trim(),.toLowerCase(),.startsWith(),.indexOf(), and.includes() - Replace every match with
.replaceAll() - Write the missing methods inline, such as
title[0].toUpperCase() + title.slice(1)for a title that isn’t empty - Split at the first separator with
.indexOf()and.slice(), and join the array elements with.join("-")
Most of that came from knowing which Python habits to keep and which to drop.