mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 18:22:40 +00:00
Rename toWordsCamel to toWordsCaps
This commit is contained in:
@@ -95,7 +95,7 @@ mathParser.functions.toWordsUpper = function (a) {
|
|||||||
mathParser.functions.toWordsLower = function (a) {
|
mathParser.functions.toWordsLower = function (a) {
|
||||||
return mathParser.functions.toWords(a).toLowerCase();
|
return mathParser.functions.toWords(a).toLowerCase();
|
||||||
};
|
};
|
||||||
mathParser.functions.toWordsCamel = function (a) {
|
mathParser.functions.toWordsCaps = function (a) {
|
||||||
const words = mathParser.functions.toWords(a).split(' ');
|
const words = mathParser.functions.toWords(a).split(' ');
|
||||||
return words.map((word)=>{
|
return words.map((word)=>{
|
||||||
return word.replace(/(?:^|\b|\s)(\w)/g, function(w, index) {
|
return word.replace(/(?:^|\b|\s)(\w)/g, function(w, index) {
|
||||||
|
|||||||
@@ -479,8 +479,8 @@ describe('Custom Math Function Tests', ()=>{
|
|||||||
expect(rendered).toBe('<p>Words: eighty thousand and eighty-five</p>');
|
expect(rendered).toBe('<p>Words: eighty thousand and eighty-five</p>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Number to Words Test - Camelcase', function() {
|
it('Number to Words Test - Capitalized', function() {
|
||||||
const source = `[a]: 80085\n\nWords: $[toWordsCamel(a)]`;
|
const source = `[a]: 80085\n\nWords: $[toWordsCaps(a)]`;
|
||||||
const rendered = Markdown.render(source).trimReturns();
|
const rendered = Markdown.render(source).trimReturns();
|
||||||
expect(rendered).toBe('<p>Words: Eighty Thousand And Eighty-Five</p>');
|
expect(rendered).toBe('<p>Words: Eighty Thousand And Eighty-Five</p>');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user