From 0a0c497204acbac562700d80f38e74aa9ffcd94e Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 1 Dec 2022 16:26:21 +0700 Subject: dynamic filter, dynamic pagination, detail brand, to title case --- src/helpers/toTitleCase.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/helpers/toTitleCase.js (limited to 'src/helpers/toTitleCase.js') diff --git a/src/helpers/toTitleCase.js b/src/helpers/toTitleCase.js new file mode 100644 index 00000000..5cfd70d0 --- /dev/null +++ b/src/helpers/toTitleCase.js @@ -0,0 +1,8 @@ +export default function toTitleCase(str) { + return str.replace( + /\w\S*/g, + function(txt) { + return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); + } + ); +} \ No newline at end of file -- cgit v1.2.3