6.7.0 - Alpha6 - Scrapers 工具的更新机制由 "锚点更新" 替换为 "结构化更新"

This commit is contained in:
SuperMonster003
2025-10-02 13:11:54 +08:00
parent f3e04b9ca2
commit 0b01bba618
33 changed files with 1599 additions and 1565 deletions

View File

@@ -24,7 +24,7 @@ const findCommonSet = (a1, a2) => {
* @param {RegExp} [options.regexForKeyMatching]
* @return {void}
*/
export function printDifferences(src, other, options = {}) {
export function printLinesDiffs(src, other, options = {}) {
const leftRaw = extractConcernedLines(src);
const rightRaw = extractConcernedLines(other);
const commonSet = findCommonSet(leftRaw, rightRaw);
@@ -134,3 +134,27 @@ export function printDifferences(src, other, options = {}) {
}
});
}
/**
* @param {Map<string,string>} src
* @param {Map<string,string>} other
*/
export function printMapDiffs(src, other) {
printLinesDiffs(mapToLines(src), mapToLines(other));
}
/**
* @param {string[]} src
* @param {string[]} other
*/
export function printListDiffs(src, other) {
printLinesDiffs(src.join('\n'), other.join('\n'));
}
/**
* @param {Map<string,string>} map
* @returns {string}
*/
function mapToLines(map) {
return Array.from(map.entries()).map(([ k, v ]) => `"${k}" to "${v}"`).join('\n');
}