MCPcopy
hub / github.com/PrismJS/prism / transformTitle

Function transformTitle

tests/dependencies-test.js:348–350  ·  view source on GitHub ↗

* Transforms the given title into an intermediate representation to allowed for sensible comparisons * between titles. * * @param {string} title

(title)

Source from the content-addressed store, hash-verified

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));

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected