* Transforms the given title into an intermediate representation to allowed for sensible comparisons * between titles. * * @param {string} title
(title)
| 346 | * @param {string} title |
| 347 | */ |
| 348 | function transformTitle(title) { |
| 349 | return title.replace(/\W+/g, '').replace(/^\d+/, '').toLowerCase(); |
| 350 | } |
| 351 | |
| 352 | const sorted = [...languages].sort((a, b) => { |
| 353 | const comp = transformTitle(a.title).localeCompare(transformTitle(b.title)); |