From f4afc91df71aaff9c7228afdf850abeff782337c Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Fri, 14 Mar 2025 08:08:30 +1300 Subject: [PATCH] Rename toWordsCamel to toWordsCaps --- shared/naturalcrit/markdown.js | 2 +- tests/markdown/variables.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index f8b79e286..1ab70eac7 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -95,7 +95,7 @@ mathParser.functions.toWordsUpper = function (a) { mathParser.functions.toWordsLower = function (a) { return mathParser.functions.toWords(a).toLowerCase(); }; -mathParser.functions.toWordsCamel = function (a) { +mathParser.functions.toWordsCaps = function (a) { const words = mathParser.functions.toWords(a).split(' '); return words.map((word)=>{ return word.replace(/(?:^|\b|\s)(\w)/g, function(w, index) { diff --git a/tests/markdown/variables.test.js b/tests/markdown/variables.test.js index 8c58f4925..3773097ab 100644 --- a/tests/markdown/variables.test.js +++ b/tests/markdown/variables.test.js @@ -479,8 +479,8 @@ describe('Custom Math Function Tests', ()=>{ expect(rendered).toBe('

Words: eighty thousand and eighty-five

'); }); - it('Number to Words Test - Camelcase', function() { - const source = `[a]: 80085\n\nWords: $[toWordsCamel(a)]`; + it('Number to Words Test - Capitalized', function() { + const source = `[a]: 80085\n\nWords: $[toWordsCaps(a)]`; const rendered = Markdown.render(source).trimReturns(); expect(rendered).toBe('

Words: Eighty Thousand And Eighty-Five

'); });