Moved toTitleCase to text-helper
This commit is contained in:
parent
70fd08c5ce
commit
9f5bb243a9
2 changed files with 17 additions and 9 deletions
|
|
@ -5,7 +5,21 @@
|
||||||
* @param {string} stringWithStyleTag
|
* @param {string} stringWithStyleTag
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export default function stripRteStyle(stringWithStyleTag) {
|
export function stripRteStyle(stringWithStyleTag) {
|
||||||
const regexExp = /[\s*]style="(.*?)"/g;
|
const regexExp = /[\s*]style="(.*?)"/g;
|
||||||
return stringWithStyleTag.replace(regexExp, '');
|
return stringWithStyleTag.replace(regexExp, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function t0TitleCase
|
||||||
|
* @summary Returns title cased string version of 'text'
|
||||||
|
* @param {string} text
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function toTitleCase(text) {
|
||||||
|
const temp = text.toLowerCase().split(' ');
|
||||||
|
for (let i = 0; i < temp.length; i++) {
|
||||||
|
temp[i] = temp[i].charAt(0).toUpperCase() + temp[i].slice(1);
|
||||||
|
}
|
||||||
|
return temp.join(' ');
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ import { fetchCmsContentForPage } from '@/helpers/cms-content-helper.js';
|
||||||
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
import BaseFormMixin from '@/mixins/base-form-mixin.js';
|
||||||
import { useMainStore } from '@/store/index.js';
|
import { useMainStore } from '@/store/index.js';
|
||||||
import globalRules from '@/constants/global-rules.js';
|
import globalRules from '@/constants/global-rules.js';
|
||||||
|
import { toTitleCase } from '@/helpers/text-helper.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'duplicate-check',
|
name: 'duplicate-check',
|
||||||
|
|
@ -111,7 +112,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
Text: duplicateOrderText,
|
Text: duplicateOrderText,
|
||||||
Name: o.referralNumber,
|
Name: o.referralNumber,
|
||||||
SubText: this.titleCase(subtext)
|
SubText: toTitleCase(subtext)
|
||||||
};
|
};
|
||||||
}) ?? [];
|
}) ?? [];
|
||||||
},
|
},
|
||||||
|
|
@ -172,13 +173,6 @@ export default {
|
||||||
: yyyyMmDd[1];
|
: yyyyMmDd[1];
|
||||||
const day = yyyyMmDd[2];
|
const day = yyyyMmDd[2];
|
||||||
return `${month}/${day}/${year}`;
|
return `${month}/${day}/${year}`;
|
||||||
},
|
|
||||||
titleCase(str) {
|
|
||||||
const temp = str.toLowerCase().split(' ');
|
|
||||||
for (let i = 0; i < temp.length; i++) {
|
|
||||||
temp[i] = temp[i].charAt(0).toUpperCase() + temp[i].slice(1);
|
|
||||||
}
|
|
||||||
return temp.join(' ');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue