6.7.0 - Alpha6 - Scrapers 工具的更新机制由 "锚点更新" 替换为 "结构化更新"
This commit is contained in:
@@ -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');
|
||||
}
|
||||
Reference in New Issue
Block a user