Skip to content

Commit 413e1c9

Browse files
committed
add typing for compare locations helper
1 parent 830e6d2 commit 413e1c9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/compareLocations.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@
33
Author Tobias Koppers @sokra
44
*/
55
"use strict";
6+
7+
/**
8+
* @typedef {Object} LineAndColumn
9+
* @property {number=} line
10+
* @property {number=} column
11+
*/
12+
13+
/**
14+
* @typedef {Object} NodeLocation
15+
* @property {LineAndColumn=} start
16+
* @property {LineAndColumn=} end
17+
* @property {number=} index
18+
*/
19+
20+
/**
21+
* Compare two locations
22+
* @param {string|NodeLocation} a
23+
* @param {string|NodeLocation} b
24+
* @returns {-1|0|1}
25+
*/
626
module.exports = (a, b) => {
727
if (typeof a === "string") {
828
if (typeof b === "string") {

0 commit comments

Comments
 (0)