Skip to content

Commit d2c6513

Browse files
authored
Merge pull request webpack#7354 from mohsen1/type-compare-locations
Type compare locations
2 parents 830e6d2 + 1a2bbc5 commit d2c6513

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 A location node
23+
* @param {string|NodeLocation} b A location node
24+
* @returns {-1|0|1} sorting comparator value
25+
*/
626
module.exports = (a, b) => {
727
if (typeof a === "string") {
828
if (typeof b === "string") {

0 commit comments

Comments
 (0)