(string)
| 608 | } |
| 609 | |
| 610 | export const humanizeString = function (string) { |
| 611 | // split strings by words, then make them all lowercase |
| 612 | const _result = string |
| 613 | .replace(/([a-z](?=[A-Z]))/g, '$1 ') |
| 614 | .split(' ') |
| 615 | .map(word => word.toLowerCase()) |
| 616 | |
| 617 | _result[0] = _result[0] === 'i' ? ucfirst(_result[0]) : _result[0] |
| 618 | return _result.join(' ').trim() |
| 619 | } |
| 620 | |
| 621 | /** |
| 622 | * Creates a circular-safe replacer function for JSON.stringify |
no test coverage detected