Replace lines-and-columns with index-to-position (#17325)
This commit is contained in:
1 parent
f406c9cab9
commit
004e1e0028
4 files changed
+13
-25
No files matched your search
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import fs from "node:fs";
|
||||
import { LinesAndColumns } from "lines-and-columns";
|
||||
import indexToPosition from "index-to-position";
|
||||
import { outdent } from "outdent";
|
||||
import { CHANGELOG_CATEGORIES } from "./utils/changelog-categories.js";
|
||||
|
||||
@@ -142,9 +142,8 @@ for (const category of CHANGELOG_CATEGORIES) {
|
||||
function getCommentDescription(content, comment) {
|
||||
const start = content.indexOf(comment);
|
||||
const end = start + comment.length;
|
||||
const linesAndColumns = new LinesAndColumns(content);
|
||||
const [startLine, endLine] = [start, end].map(
|
||||
(index) => linesAndColumns.locationForIndex(index).line + 1,
|
||||
(index) => indexToPosition(content, index, { oneBased: true }).line,
|
||||
);
|
||||
|
||||
if (startLine === endLine) {
|
||||
|
||||
Reference in new issue
Block a user