{"size": 769, "ext": "js", "max_stars_repo_path": "5-kyu/Break camelCase/index.js", "max_stars_repo_name": "ayessetova/codeW", "max_stars_repo_stars_event_min_datetime": "2017-12-08T16:51:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T01:59:49.000Z", "max_issues_repo_path": "5-kyu/Break camelCase/index.js", "max_issues_repo_name": "ayessetova/codeW", "max_issues_repo_issues_event_min_datetime": "2018-04-27T03:54:20.000Z", "max_issues_repo_issues_event_max_datetime": "2020-12-06T20:13:40.000Z", "max_forks_repo_path": "5-kyu/Break camelCase/index.js", "max_forks_repo_name": "ayessetova/codeW", "max_forks_repo_forks_event_min_datetime": "2017-12-18T18:19:13.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-29T12:16:38.000Z"}
{"max_stars_count": 314, "max_issues_count": 4, "max_forks_count": 141, "avg_line_length": 23.303030303, "max_line_length": 103, "alphanum_fraction": 0.6749024707}
/*
  Description:
    Complete the solution so that the function will break up camel casing, using a space between words.

  Example:
    solution('camelCasing') // => should return 'camel Casing'

  Kata Link:
    https://www.codewars.com/kata/break-camelcase

  Discuss Link:
    https://www.codewars.com/kata/zero-fill-dot-dot-dot-for-the-queen/discuss

  Solutions Link:
    https://www.codewars.com/kata/zero-fill-dot-dot-dot-for-the-queen/solutions
*/

// Long solution
/*
function breakCamelCase(string) {
  return string
    .split('')
    .map(char => (char === char.toUpperCase() ? ` ${char}` : char))
    .join('')
}
*/

// Short solution
const breakCamelCase = string => string.replace(/([A-Z])/g, ' $1')

// Function Export
module.exports = breakCamelCase
