#6 Fix naming to use `toPoint`

Merged Titus wooorm
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 6 files from the diff.
Other files ignored by Codecov
package.json has changed.
types/index.d.ts has changed.
test.js has changed.
readme.md has changed.

@@ -4,20 +4,22 @@
Loading
4 4
5 5
function factory(file) {
6 6
  var contents = indices(String(file))
7 +
  var toPoint = offsetToPointFactory(contents)
7 8
8 9
  return {
9 -
    toPosition: offsetToPositionFactory(contents),
10 -
    toOffset: positionToOffsetFactory(contents)
10 +
    toPoint: toPoint,
11 +
    toPosition: toPoint,
12 +
    toOffset: pointToOffsetFactory(contents)
11 13
  }
12 14
}
13 15
14 -
// Factory to get the line and column-based `position` for `offset` in the bound
16 +
// Factory to get the line and column-based `point` for `offset` in the bound
15 17
// indices.
16 -
function offsetToPositionFactory(indices) {
17 -
  return offsetToPosition
18 +
function offsetToPointFactory(indices) {
19 +
  return offsetToPoint
18 20
19 -
  // Get the line and column-based `position` for `offset` in the bound indices.
20 -
  function offsetToPosition(offset) {
21 +
  // Get the line and column-based `point` for `offset` in the bound indices.
22 +
  function offsetToPoint(offset) {
21 23
    var index = -1
22 24
    var length = indices.length
23 25
@@ -39,16 +41,16 @@
Loading
39 41
  }
40 42
}
41 43
42 -
// Factory to get the `offset` for a line and column-based `position` in the
44 +
// Factory to get the `offset` for a line and column-based `point` in the
43 45
// bound indices.
44 -
function positionToOffsetFactory(indices) {
45 -
  return positionToOffset
46 +
function pointToOffsetFactory(indices) {
47 +
  return pointToOffset
46 48
47 -
  // Get the `offset` for a line and column-based `position` in the bound
49 +
  // Get the `offset` for a line and column-based `point` in the bound
48 50
  // indices.
49 -
  function positionToOffset(position) {
50 -
    var line = position && position.line
51 -
    var column = position && position.column
51 +
  function pointToOffset(point) {
52 +
    var line = point && point.line
53 +
    var column = point && point.column
52 54
53 55
    if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {
54 56
      return (indices[line - 2] || 0) + column - 1 || 0

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