printer-notifications/node_modules/svelte-eslint-parser/lib/parser/sort.js

19 lines
412 B
JavaScript
Raw Normal View History

2023-11-13 21:10:04 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sortNodes = void 0;
/**
* Sort tokens
*/
function sortNodes(tokens) {
if (!tokens) {
return [];
}
return tokens.sort((a, b) => {
if (a.range[0] !== b.range[0]) {
return a.range[0] - b.range[0];
}
return a.range[1] - b.range[1];
});
}
exports.sortNodes = sortNodes;