wooorm / trim-lines

Compare ca1b0bf ... +0 ... 2475a3d

Coverage Reach
index.js

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 2 files from the diff.
Other files ignored by Codecov
test.js has changed.

@@ -1,5 +1,5 @@
Loading
1 -
const SPACE = 32
2 -
const TAB = 9
1 +
const tab = 9 /* `\t` */
2 +
const space = 32 /* ` ` */
3 3
4 4
/**
5 5
 * Remove initial and final spaces and tabs at the line breaks in `value`.
@@ -20,32 +20,37 @@
Loading
20 20
21 21
  while (match) {
22 22
    lines.push(
23 -
      trimLine(source.slice(last, match.index), last !== 0, true),
23 +
      trimLine(source.slice(last, match.index), last > 0, true),
24 24
      match[0]
25 25
    )
26 26
27 27
    last = match.index + match[0].length
28 28
    match = search.exec(source)
29 29
  }
30 30
31 -
  lines.push(trimLine(source.slice(last), last !== 0, false))
31 +
  lines.push(trimLine(source.slice(last), last > 0, false))
32 32
33 33
  return lines.join('')
34 34
}
35 35
36 36
/**
37 37
 * @param {string} value
38 +
 *   Line to trim.
38 39
 * @param {boolean} start
40 +
 *   Whether to trim the start of the line.
39 41
 * @param {boolean} end
42 +
 *   Whether to trim the end of the line.
40 43
 * @returns {string}
44 +
 *   Trimmed line.
41 45
 */
42 46
function trimLine(value, start, end) {
43 47
  let startIndex = 0
44 48
  let endIndex = value.length
49 +
45 50
  if (start) {
46 51
    let code = value.codePointAt(startIndex)
47 52
48 -
    while (code === SPACE || code === TAB) {
53 +
    while (code === tab || code === space) {
49 54
      startIndex++
50 55
      code = value.codePointAt(startIndex)
51 56
    }
@@ -54,7 +59,7 @@
Loading
54 59
  if (end) {
55 60
    let code = value.codePointAt(endIndex - 1)
56 61
57 -
    while (code === SPACE || code === TAB) {
62 +
    while (code === tab || code === space) {
58 63
      endIndex--
59 64
      code = value.codePointAt(endIndex - 1)
60 65
    }

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
index.js 100.00%
Project Totals (1 files) 100.00%
Loading