From 440670ce2f17a9381872ce6943ae5f8229d34b53 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Tue, 17 Dec 2024 19:38:08 +0530 Subject: [PATCH] apply nitpicks --- scripts/build-post-list.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/build-post-list.js b/scripts/build-post-list.js index 10ade062dc40..90298401d96f 100644 --- a/scripts/build-post-list.js +++ b/scripts/build-post-list.js @@ -183,7 +183,9 @@ async function isDirectory(dir) { } function capitalize(text) { - return text.replace(/(?:^|\s|-)([a-z])/g, (_, char) => char.toUpperCase()) + return text.split(/[\s-]/) + .map(word => word.charAt(0).toUpperCase() + word.slice(1)) + .join(' '); } module.exports = { slugifyToC, buildPostList }