UNPKG

hd-utils

Version:

A handy utils for modern JS developers

13 lines (12 loc) 443 B
import { upperCaseRegex } from '../../regex/index'; /** * @description It splits a string into an array of strings, where each string is a word, number, or capitalized * word * @example splitUpperCase("JavaScript") // ["Java", "Script"] * @param {string} str - string - The string to split * @returns An array of strings. */ const splitUpperCase = (str) => { return str.match(upperCaseRegex) || []; }; export default splitUpperCase;