UNPKG

ab-helpers

Version:

A collection of helper functions for various tasks

25 lines (20 loc) 576 B
function capitalizeFirstLetter(str) { return str.charAt(0).toUpperCase() + str.slice(1); } function formatNumberWithSeparator(number, separator) { return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, separator); } function getFullname(...fullname) { return fullname.filter((str) => !!str).join(" "); } function getFileExtension(filename) { const parts = filename.split("."); if (parts.length > 1) return parts.pop().toLowerCase(); return ""; } module.exports = { capitalizeFirstLetter, formatNumberWithSeparator, getFullname, getFileExtension, };