panzerdp / voca
Showing 1 of 5 files from the diff.
Other files ignored by Codecov

@@ -1,6 +1,7 @@
Loading
1 1
import { REGEXP_EXTENDED_ASCII, REGEXP_LATIN_WORD, REGEXP_WORD } from 'helper/reg_exp/const_extended';
2 2
import capitalize from 'case/capitalize';
3 3
import coerceToString from 'helper/string/coerce_to_string';
4 +
import coerceToBoolean from 'helper/boolean/coerce_to_boolean';
4 5
5 6
/**
6 7
 * Converts the subject to title case.
@@ -11,20 +12,25 @@
Loading
11 12
 * @memberOf Case
12 13
 * @param  {string} [subject=''] The string to convert to title case.
13 14
 * @param  {Array}  [noSplit]    Do not split words at the specified characters.
15 +
 * @param  {boolean} [preserveUpperCase=false] preserve uppercases.
14 16
 * @return {string}              Returns the title case string.
15 17
 * @example
16 18
 * v.titleCase('learning to fly');
17 19
 * // => 'Learning To Fly'
18 20
 *
21 +
 * v.titleCase('XMLHttpRequest', preserveUpperCase=true);
22 +
 * // => 'XMLHttpRequest'
23 +
 *
19 24
 * v.titleCase('jean-luc is good-looking', ['-']);
20 25
 * // => 'Jean-luc Is Good-looking'
21 26
 */
22 -
export default function titleCase(subject, noSplit) {
27 +
export default function titleCase(subject, noSplit, preserveUpperCase) {
23 28
  const subjectString = coerceToString(subject);
24 29
  const noSplitArray = Array.isArray(noSplit) ? noSplit : [];
30 +
  const preserveUpperCaseBoolean = coerceToBoolean(preserveUpperCase);
25 31
  const wordsRegExp = REGEXP_EXTENDED_ASCII.test(subjectString) ? REGEXP_LATIN_WORD : REGEXP_WORD;
26 32
  return subjectString.replace(wordsRegExp, function(word, index) {
27 33
    const isNoSplit = index > 0 && noSplitArray.indexOf(subjectString[index - 1]) >= 0;
28 -
    return isNoSplit ? word.toLowerCase() : capitalize(word, true);
34 +
    return isNoSplit ? word.toLowerCase() : capitalize(word, !preserveUpperCaseBoolean);
29 35
  });
30 36
}
Files Coverage
src 98.85%
Project Totals (108 files) 98.85%
333.1
10=0
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading