spread-diff-patch
Advanced tools
| /** | ||
| * Represents a Formatter class. | ||
| * @template T - The type parameter for the Formatter class. | ||
| */ | ||
| declare class Formatter<T> { | ||
| patch: (actual: string | null, expected: string | null) => string; | ||
| /** | ||
| * Creates an instance of Formatter. | ||
| * @param {Function} patcher - The patcher function used to generate the patched string. | ||
| */ | ||
| constructor(patcher?: (actual: string | null, expected: string | null) => string); | ||
| /** | ||
| * Formats the diff array of arrays. | ||
| * @param diffAOA - The diff array of arrays to be formatted. | ||
| * @returns The formatted string. | ||
| */ | ||
| format(diffAOA: DiffAOA<T>): string; | ||
| } | ||
| /** | ||
| * Represents the differences between two arrays of arrays (AOA) with a customizable format. | ||
| * @template T - The type of data in the arrays of arrays. | ||
| */ | ||
| declare class DiffAOA<T> extends Array<Array<T | Array<T | null>>> { | ||
| #private; | ||
| /** | ||
| * Formats the differences using the provided formatter. | ||
| * @param formatter - The formatter object responsible for generating the formatted string. | ||
| * @returns The formatted string representing the differences. | ||
| */ | ||
| format(formatter: Formatter<T>): string; | ||
| /** | ||
| * Gets the count of differences in the array of arrays. | ||
| * @returns The number of differences. | ||
| */ | ||
| get diffCount(): number; | ||
| /** | ||
| * Sets the count of differences in the array of arrays. | ||
| * @param value - The number of differences to set. | ||
| */ | ||
| set diffCount(value: number); | ||
| } | ||
| export { DiffAOA as D, Formatter as F }; |
| /** | ||
| * Represents a Formatter class. | ||
| * @template T - The type parameter for the Formatter class. | ||
| */ | ||
| declare class Formatter<T> { | ||
| patch: (actual: string | null, expected: string | null) => string; | ||
| /** | ||
| * Creates an instance of Formatter. | ||
| * @param {Function} patcher - The patcher function used to generate the patched string. | ||
| */ | ||
| constructor(patcher?: (actual: string | null, expected: string | null) => string); | ||
| /** | ||
| * Formats the diff array of arrays. | ||
| * @param diffAOA - The diff array of arrays to be formatted. | ||
| * @returns The formatted string. | ||
| */ | ||
| format(diffAOA: DiffAOA<T>): string; | ||
| } | ||
| /** | ||
| * Represents the differences between two arrays of arrays (AOA) with a customizable format. | ||
| * @template T - The type of data in the arrays of arrays. | ||
| */ | ||
| declare class DiffAOA<T> extends Array<Array<T | Array<T | null>>> { | ||
| #private; | ||
| /** | ||
| * Formats the differences using the provided formatter. | ||
| * @param formatter - The formatter object responsible for generating the formatted string. | ||
| * @returns The formatted string representing the differences. | ||
| */ | ||
| format(formatter: Formatter<T>): string; | ||
| /** | ||
| * Gets the count of differences in the array of arrays. | ||
| * @returns The number of differences. | ||
| */ | ||
| get diffCount(): number; | ||
| /** | ||
| * Sets the count of differences in the array of arrays. | ||
| * @param value - The number of differences to set. | ||
| */ | ||
| set diffCount(value: number); | ||
| } | ||
| export { DiffAOA as D, Formatter as F }; |
| export { } |
| export { } |
| "use strict"; | ||
| // src/formatter/script.js | ||
| function isHTML(str) { | ||
| var doc = new DOMParser().parseFromString(str, "text/html"); | ||
| return Array.from(doc.body.childNodes).some((node) => node.nodeType === 1); | ||
| } | ||
| var diffAOA = JSON.parse(document.querySelector("#spread-diff-patch-data").dataset.rawDiffaoa); | ||
| var app = document.querySelector("#spread-diff-patch"); | ||
| var gridElement = document.createElement("div"); | ||
| gridElement.id = "diff-grid"; | ||
| var grid = canvasDatagrid({ | ||
| parentNode: gridElement, | ||
| editable: false | ||
| }); | ||
| app.append(gridElement); | ||
| grid.style.height = "100%"; | ||
| grid.style.width = "100%"; | ||
| grid.data = diffAOA; | ||
| grid.addEventListener("afterrendercell", function(e) { | ||
| if (isHTML(e.cell.value)) | ||
| e.cell.innerHTML = e.cell.value; | ||
| }); | ||
| //# sourceMappingURL=script.js.map |
| {"version":3,"sources":["../../src/formatter/script.js"],"sourcesContent":["/* eslint-disable no-undef */\r\nfunction isHTML(str) {\r\n var doc = new DOMParser().parseFromString(str, \"text/html\");\r\n return Array.from(doc.body.childNodes).some(node => node.nodeType === 1);\r\n}\r\n\r\nconst diffAOA = JSON.parse(document.querySelector(\"#spread-diff-patch-data\").dataset.rawDiffaoa)\r\n\r\nconst app = document.querySelector('#spread-diff-patch');\r\nconst gridElement = document.createElement('div');\r\ngridElement.id = \"diff-grid\"\r\nconst grid = canvasDatagrid({\r\n parentNode: gridElement,\r\n editable: false,\r\n});\r\n\r\napp.append(gridElement);\r\n\r\ngrid.style.height = '100%';\r\ngrid.style.width = '100%';\r\ngrid.data = diffAOA\r\n\r\ngrid.addEventListener('afterrendercell', function (e) {\r\n if (isHTML(e.cell.value))\r\n e.cell.innerHTML = e.cell.value\r\n});"],"mappings":";;;AACA,SAAS,OAAO,KAAK;AACjB,MAAI,MAAM,IAAI,UAAU,EAAE,gBAAgB,KAAK,WAAW;AAC1D,SAAO,MAAM,KAAK,IAAI,KAAK,UAAU,EAAE,KAAK,UAAQ,KAAK,aAAa,CAAC;AAC3E;AAEA,IAAM,UAAU,KAAK,MAAM,SAAS,cAAc,yBAAyB,EAAE,QAAQ,UAAU;AAE/F,IAAM,MAAM,SAAS,cAAc,oBAAoB;AACvD,IAAM,cAAc,SAAS,cAAc,KAAK;AAChD,YAAY,KAAK;AACjB,IAAM,OAAO,eAAe;AAAA,EACxB,YAAY;AAAA,EACZ,UAAU;AACd,CAAC;AAED,IAAI,OAAO,WAAW;AAEtB,KAAK,MAAM,SAAS;AACpB,KAAK,MAAM,QAAQ;AACnB,KAAK,OAAO;AAEZ,KAAK,iBAAiB,mBAAmB,SAAU,GAAG;AAClD,MAAI,OAAO,EAAE,KAAK,KAAK;AACnB,MAAE,KAAK,YAAY,EAAE,KAAK;AAClC,CAAC;","names":[]} |
| // src/formatter/script.js | ||
| function isHTML(str) { | ||
| var doc = new DOMParser().parseFromString(str, "text/html"); | ||
| return Array.from(doc.body.childNodes).some((node) => node.nodeType === 1); | ||
| } | ||
| var diffAOA = JSON.parse(document.querySelector("#spread-diff-patch-data").dataset.rawDiffaoa); | ||
| var app = document.querySelector("#spread-diff-patch"); | ||
| var gridElement = document.createElement("div"); | ||
| gridElement.id = "diff-grid"; | ||
| var grid = canvasDatagrid({ | ||
| parentNode: gridElement, | ||
| editable: false | ||
| }); | ||
| app.append(gridElement); | ||
| grid.style.height = "100%"; | ||
| grid.style.width = "100%"; | ||
| grid.data = diffAOA; | ||
| grid.addEventListener("afterrendercell", function(e) { | ||
| if (isHTML(e.cell.value)) | ||
| e.cell.innerHTML = e.cell.value; | ||
| }); | ||
| //# sourceMappingURL=script.mjs.map |
| {"version":3,"sources":["../../src/formatter/script.js"],"sourcesContent":["/* eslint-disable no-undef */\r\nfunction isHTML(str) {\r\n var doc = new DOMParser().parseFromString(str, \"text/html\");\r\n return Array.from(doc.body.childNodes).some(node => node.nodeType === 1);\r\n}\r\n\r\nconst diffAOA = JSON.parse(document.querySelector(\"#spread-diff-patch-data\").dataset.rawDiffaoa)\r\n\r\nconst app = document.querySelector('#spread-diff-patch');\r\nconst gridElement = document.createElement('div');\r\ngridElement.id = \"diff-grid\"\r\nconst grid = canvasDatagrid({\r\n parentNode: gridElement,\r\n editable: false,\r\n});\r\n\r\napp.append(gridElement);\r\n\r\ngrid.style.height = '100%';\r\ngrid.style.width = '100%';\r\ngrid.data = diffAOA\r\n\r\ngrid.addEventListener('afterrendercell', function (e) {\r\n if (isHTML(e.cell.value))\r\n e.cell.innerHTML = e.cell.value\r\n});"],"mappings":";AACA,SAAS,OAAO,KAAK;AACjB,MAAI,MAAM,IAAI,UAAU,EAAE,gBAAgB,KAAK,WAAW;AAC1D,SAAO,MAAM,KAAK,IAAI,KAAK,UAAU,EAAE,KAAK,UAAQ,KAAK,aAAa,CAAC;AAC3E;AAEA,IAAM,UAAU,KAAK,MAAM,SAAS,cAAc,yBAAyB,EAAE,QAAQ,UAAU;AAE/F,IAAM,MAAM,SAAS,cAAc,oBAAoB;AACvD,IAAM,cAAc,SAAS,cAAc,KAAK;AAChD,YAAY,KAAK;AACjB,IAAM,OAAO,eAAe;AAAA,EACxB,YAAY;AAAA,EACZ,UAAU;AACd,CAAC;AAED,IAAI,OAAO,WAAW;AAEtB,KAAK,MAAM,SAAS;AACpB,KAAK,MAAM,QAAQ;AACnB,KAAK,OAAO;AAEZ,KAAK,iBAAiB,mBAAmB,SAAU,GAAG;AAClD,MAAI,OAAO,EAAE,KAAK,KAAK;AACnB,MAAE,KAAK,YAAY,EAAE,KAAK;AAClC,CAAC;","names":[]} |
@@ -1,2 +0,2 @@ | ||
| import Formatter from './index.mjs'; | ||
| import { F as Formatter } from '../DiffAOA-mlvW9HLo.mjs'; | ||
@@ -3,0 +3,0 @@ type DiffAOA = (string | (string | null)[])[][]; |
@@ -1,2 +0,2 @@ | ||
| import Formatter from './index.js'; | ||
| import { F as Formatter } from '../DiffAOA-mlvW9HLo.js'; | ||
@@ -3,0 +3,0 @@ type DiffAOA = (string | (string | null)[])[][]; |
@@ -58,4 +58,4 @@ "use strict"; | ||
| * Formats the diff array of arrays. | ||
| * @param {T[][]} diffAOA - The diff array of arrays to be formatted. | ||
| * @returns {string} The formatted string. | ||
| * @param diffAOA - The diff array of arrays to be formatted. | ||
| * @returns The formatted string. | ||
| */ | ||
@@ -62,0 +62,0 @@ format(diffAOA) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/formatter/csv.ts","../../src/formatter/index.ts"],"sourcesContent":["import Papa from \"papaparse\";\r\nimport Formatter from \".\"\r\n\r\ntype DiffAOA = (string | (string | null)[])[][]\r\n\r\n/**\r\n * Represents a CSV formatter that converts a DiffAOA (Array of Arrays) into a CSV string.\r\n */\r\nexport class CSV extends Formatter<string> {\r\n /**\r\n * Formats the given DiffAOA into a CSV string.\r\n * @param diffAOA - The DiffAOA to be formatted.\r\n * @returns The formatted CSV string.\r\n */\r\n format(diffAOA: DiffAOA): string {\r\n const patchedAOA = diffAOA.map((row) => {\r\n return row.map((cell) => Array.isArray(cell) ? this.patch(cell[0],cell[1]) : cell)\r\n })\r\n return Papa.unparse(patchedAOA);\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param {T[][]} diffAOA - The diff array of arrays to be formatted.\r\n * @returns {string} The formatted string.\r\n */\r\n format(diffAOA: T[][]): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAiB;;;ACMjB,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAAwB;AAC3B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;;;AD5BO,IAAM,MAAN,cAAkB,UAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,OAAO,SAA0B;AAC7B,UAAM,aAAa,QAAQ,IAAI,CAAC,QAAQ;AACpC,aAAO,IAAI,IAAI,CAAC,SAAS,MAAM,QAAQ,IAAI,IAAI,KAAK,MAAM,KAAK,CAAC,GAAE,KAAK,CAAC,CAAC,IAAI,IAAI;AAAA,IACrF,CAAC;AACD,WAAO,iBAAAA,QAAK,QAAQ,UAAU;AAAA,EAClC;AACJ;","names":["Papa"]} | ||
| {"version":3,"sources":["../../src/formatter/csv.ts","../../src/formatter/index.ts"],"sourcesContent":["import Papa from \"papaparse\";\r\nimport Formatter from \".\"\r\n\r\ntype DiffAOA = (string | (string | null)[])[][]\r\n\r\n/**\r\n * Represents a CSV formatter that converts a DiffAOA (Array of Arrays) into a CSV string.\r\n */\r\nexport class CSV extends Formatter<string> {\r\n /**\r\n * Formats the given DiffAOA into a CSV string.\r\n * @param diffAOA - The DiffAOA to be formatted.\r\n * @returns The formatted CSV string.\r\n */\r\n format(diffAOA: DiffAOA): string {\r\n const patchedAOA = diffAOA.map((row) => {\r\n return row.map((cell) => Array.isArray(cell) ? this.patch(cell[0],cell[1]) : cell)\r\n })\r\n return Papa.unparse(patchedAOA);\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\nimport DiffAOA from \"../DiffAOA\"\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param diffAOA - The diff array of arrays to be formatted.\r\n * @returns The formatted string.\r\n */\r\n format(diffAOA: DiffAOA<T>): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAiB;;;ACQjB,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAA6B;AAChC,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;;;AD9BO,IAAM,MAAN,cAAkB,UAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,OAAO,SAA0B;AAC7B,UAAM,aAAa,QAAQ,IAAI,CAAC,QAAQ;AACpC,aAAO,IAAI,IAAI,CAAC,SAAS,MAAM,QAAQ,IAAI,IAAI,KAAK,MAAM,KAAK,CAAC,GAAE,KAAK,CAAC,CAAC,IAAI,IAAI;AAAA,IACrF,CAAC;AACD,WAAO,iBAAAA,QAAK,QAAQ,UAAU;AAAA,EAClC;AACJ;","names":["Papa"]} |
@@ -24,4 +24,4 @@ // src/formatter/csv.ts | ||
| * Formats the diff array of arrays. | ||
| * @param {T[][]} diffAOA - The diff array of arrays to be formatted. | ||
| * @returns {string} The formatted string. | ||
| * @param diffAOA - The diff array of arrays to be formatted. | ||
| * @returns The formatted string. | ||
| */ | ||
@@ -28,0 +28,0 @@ format(diffAOA) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/formatter/csv.ts","../../src/formatter/index.ts"],"sourcesContent":["import Papa from \"papaparse\";\r\nimport Formatter from \".\"\r\n\r\ntype DiffAOA = (string | (string | null)[])[][]\r\n\r\n/**\r\n * Represents a CSV formatter that converts a DiffAOA (Array of Arrays) into a CSV string.\r\n */\r\nexport class CSV extends Formatter<string> {\r\n /**\r\n * Formats the given DiffAOA into a CSV string.\r\n * @param diffAOA - The DiffAOA to be formatted.\r\n * @returns The formatted CSV string.\r\n */\r\n format(diffAOA: DiffAOA): string {\r\n const patchedAOA = diffAOA.map((row) => {\r\n return row.map((cell) => Array.isArray(cell) ? this.patch(cell[0],cell[1]) : cell)\r\n })\r\n return Papa.unparse(patchedAOA);\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param {T[][]} diffAOA - The diff array of arrays to be formatted.\r\n * @returns {string} The formatted string.\r\n */\r\n format(diffAOA: T[][]): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";AAAA,OAAO,UAAU;;;ACMjB,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAAwB;AAC3B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;;;AD5BO,IAAM,MAAN,cAAkB,UAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,OAAO,SAA0B;AAC7B,UAAM,aAAa,QAAQ,IAAI,CAAC,QAAQ;AACpC,aAAO,IAAI,IAAI,CAAC,SAAS,MAAM,QAAQ,IAAI,IAAI,KAAK,MAAM,KAAK,CAAC,GAAE,KAAK,CAAC,CAAC,IAAI,IAAI;AAAA,IACrF,CAAC;AACD,WAAO,KAAK,QAAQ,UAAU;AAAA,EAClC;AACJ;","names":[]} | ||
| {"version":3,"sources":["../../src/formatter/csv.ts","../../src/formatter/index.ts"],"sourcesContent":["import Papa from \"papaparse\";\r\nimport Formatter from \".\"\r\n\r\ntype DiffAOA = (string | (string | null)[])[][]\r\n\r\n/**\r\n * Represents a CSV formatter that converts a DiffAOA (Array of Arrays) into a CSV string.\r\n */\r\nexport class CSV extends Formatter<string> {\r\n /**\r\n * Formats the given DiffAOA into a CSV string.\r\n * @param diffAOA - The DiffAOA to be formatted.\r\n * @returns The formatted CSV string.\r\n */\r\n format(diffAOA: DiffAOA): string {\r\n const patchedAOA = diffAOA.map((row) => {\r\n return row.map((cell) => Array.isArray(cell) ? this.patch(cell[0],cell[1]) : cell)\r\n })\r\n return Papa.unparse(patchedAOA);\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\nimport DiffAOA from \"../DiffAOA\"\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param diffAOA - The diff array of arrays to be formatted.\r\n * @returns The formatted string.\r\n */\r\n format(diffAOA: DiffAOA<T>): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";AAAA,OAAO,UAAU;;;ACQjB,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAA6B;AAChC,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;;;AD9BO,IAAM,MAAN,cAAkB,UAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvC,OAAO,SAA0B;AAC7B,UAAM,aAAa,QAAQ,IAAI,CAAC,QAAQ;AACpC,aAAO,IAAI,IAAI,CAAC,SAAS,MAAM,QAAQ,IAAI,IAAI,KAAK,MAAM,KAAK,CAAC,GAAE,KAAK,CAAC,CAAC,IAAI,IAAI;AAAA,IACrF,CAAC;AACD,WAAO,KAAK,QAAQ,UAAU;AAAA,EAClC;AACJ;","names":[]} |
@@ -1,8 +0,8 @@ | ||
| import Formatter from './index.mjs'; | ||
| import { F as Formatter, D as DiffAOA } from '../DiffAOA-mlvW9HLo.mjs'; | ||
| type DiffAOA = (string | (string | null)[])[][]; | ||
| declare class HTML extends Formatter<string> { | ||
| format(diffAOA: DiffAOA): string; | ||
| constructor(patcher?: (actual: string | null, expected: string | null) => string); | ||
| format(diffAOA: DiffAOA<string>): string; | ||
| } | ||
| export { HTML }; |
@@ -1,8 +0,8 @@ | ||
| import Formatter from './index.js'; | ||
| import { F as Formatter, D as DiffAOA } from '../DiffAOA-mlvW9HLo.js'; | ||
| type DiffAOA = (string | (string | null)[])[][]; | ||
| declare class HTML extends Formatter<string> { | ||
| format(diffAOA: DiffAOA): string; | ||
| constructor(patcher?: (actual: string | null, expected: string | null) => string); | ||
| format(diffAOA: DiffAOA<string>): string; | ||
| } | ||
| export { HTML }; |
| "use strict"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
@@ -18,2 +20,10 @@ var __export = (target, all) => { | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
@@ -48,4 +58,4 @@ | ||
| * Formats the diff array of arrays. | ||
| * @param {T[][]} diffAOA - The diff array of arrays to be formatted. | ||
| * @returns {string} The formatted string. | ||
| * @param diffAOA - The diff array of arrays to be formatted. | ||
| * @returns The formatted string. | ||
| */ | ||
@@ -58,5 +68,45 @@ format(diffAOA) { | ||
| // src/formatter/html.ts | ||
| var import_fs = __toESM(require("fs")); | ||
| var import_escape_html = __toESM(require("escape-html")); | ||
| var import_path = __toESM(require("path")); | ||
| var HTML = class extends Formatter { | ||
| constructor(patcher = (actual, expected) => { | ||
| let patchedString = ""; | ||
| if (actual) | ||
| patchedString += `<span style="background:#ffbbbb;"><s>${actual}</s></span>`; | ||
| if (actual && expected) | ||
| patchedString += " "; | ||
| if (expected) | ||
| patchedString += `<span style="background:#bbffbb;">${expected}</span>`; | ||
| return patchedString; | ||
| }) { | ||
| super(patcher); | ||
| this.patch = patcher; | ||
| } | ||
| format(diffAOA) { | ||
| throw new Error("Method not implemented."); | ||
| const script = import_fs.default.readFileSync(import_path.default.resolve(__dirname, "./script.js"), "utf8"); | ||
| const patchedAOA = diffAOA.map((row) => { | ||
| return row.map((cell) => { | ||
| if (Array.isArray(cell)) { | ||
| return this.patch(cell[0], cell[1]); | ||
| } | ||
| return cell; | ||
| }); | ||
| }); | ||
| return ` | ||
| <div id="spread-diff-patch"> | ||
| <style> | ||
| * { | ||
| box-sizing: border-box; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
| </style> | ||
| <div id="spread-diff-patch-data" data-raw-diffAOA='${(0, import_escape_html.default)(JSON.stringify(patchedAOA))}'></div> | ||
| <script src="https://unpkg.com/canvas-datagrid"></script> | ||
| <script> | ||
| ${script} | ||
| </script> | ||
| </div> | ||
| `; | ||
| } | ||
@@ -63,0 +113,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/formatter/html.ts","../../src/formatter/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport Formatter from \".\"\r\n\r\ntype DiffAOA = (string | (string | null)[])[][]\r\n\r\nexport class HTML extends Formatter<string> {\r\n format(diffAOA: DiffAOA): string {\r\n // TODO: Implement HTML formatting\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param {T[][]} diffAOA - The diff array of arrays to be formatted.\r\n * @returns {string} The formatted string.\r\n */\r\n format(diffAOA: T[][]): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAAwB;AAC3B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;;;AD/BO,IAAM,OAAN,cAAmB,UAAkB;AAAA,EACxC,OAAO,SAA0B;AAE7B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;","names":[]} | ||
| {"version":3,"sources":["../../src/formatter/html.ts","../../src/formatter/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport Formatter from \".\"\r\nimport fs from \"fs\"\r\nimport escapeHTML from \"escape-html\"\r\nimport DiffAOA from \"../DiffAOA\"\r\nimport path from \"path\"\r\n\r\nexport class HTML extends Formatter<string> {\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `<span style=\"background:#ffbbbb;\"><s>${actual}</s></span>`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `<span style=\"background:#bbffbb;\">${expected}</span>`\r\n return patchedString\r\n }\r\n ) {\r\n super(patcher)\r\n this.patch = patcher\r\n }\r\n format(diffAOA: DiffAOA<string>): string {\r\n const script = fs.readFileSync(path.resolve(__dirname, \"./script.js\"), \"utf8\");\r\n const patchedAOA = diffAOA.map((row) => {\r\n return row.map((cell) => {\r\n if (Array.isArray(cell)) {\r\n return this.patch(cell[0], cell[1])\r\n }\r\n return cell;\r\n });\r\n })\r\n return `\r\n <div id=\"spread-diff-patch\">\r\n <style>\r\n * {\r\n box-sizing: border-box;\r\n margin: 0;\r\n padding: 0;\r\n }\r\n </style>\r\n <div id=\"spread-diff-patch-data\" data-raw-diffAOA='${escapeHTML(JSON.stringify(patchedAOA))}'></div>\r\n <script src=\"https://unpkg.com/canvas-datagrid\"></script>\r\n <script>\r\n ${script}\r\n </script>\r\n </div>\r\n `\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\nimport DiffAOA from \"../DiffAOA\"\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param diffAOA - The diff array of arrays to be formatted.\r\n * @returns The formatted string.\r\n */\r\n format(diffAOA: DiffAOA<T>): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;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AAA;AAAA;AAAA,EAIpB;AACJ;","names":["fs","path","escapeHTML"]} |
@@ -21,4 +21,4 @@ // src/formatter/index.ts | ||
| * Formats the diff array of arrays. | ||
| * @param {T[][]} diffAOA - The diff array of arrays to be formatted. | ||
| * @returns {string} The formatted string. | ||
| * @param diffAOA - The diff array of arrays to be formatted. | ||
| * @returns The formatted string. | ||
| */ | ||
@@ -31,5 +31,45 @@ format(diffAOA) { | ||
| // src/formatter/html.ts | ||
| import fs from "fs"; | ||
| import escapeHTML from "escape-html"; | ||
| import path from "path"; | ||
| var HTML = class extends Formatter { | ||
| constructor(patcher = (actual, expected) => { | ||
| let patchedString = ""; | ||
| if (actual) | ||
| patchedString += `<span style="background:#ffbbbb;"><s>${actual}</s></span>`; | ||
| if (actual && expected) | ||
| patchedString += " "; | ||
| if (expected) | ||
| patchedString += `<span style="background:#bbffbb;">${expected}</span>`; | ||
| return patchedString; | ||
| }) { | ||
| super(patcher); | ||
| this.patch = patcher; | ||
| } | ||
| format(diffAOA) { | ||
| throw new Error("Method not implemented."); | ||
| const script = fs.readFileSync(path.resolve(__dirname, "./script.js"), "utf8"); | ||
| const patchedAOA = diffAOA.map((row) => { | ||
| return row.map((cell) => { | ||
| if (Array.isArray(cell)) { | ||
| return this.patch(cell[0], cell[1]); | ||
| } | ||
| return cell; | ||
| }); | ||
| }); | ||
| return ` | ||
| <div id="spread-diff-patch"> | ||
| <style> | ||
| * { | ||
| box-sizing: border-box; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
| </style> | ||
| <div id="spread-diff-patch-data" data-raw-diffAOA='${escapeHTML(JSON.stringify(patchedAOA))}'></div> | ||
| <script src="https://unpkg.com/canvas-datagrid"></script> | ||
| <script> | ||
| ${script} | ||
| </script> | ||
| </div> | ||
| `; | ||
| } | ||
@@ -36,0 +76,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/formatter/index.ts","../../src/formatter/html.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param {T[][]} diffAOA - The diff array of arrays to be formatted.\r\n * @returns {string} The formatted string.\r\n */\r\n format(diffAOA: T[][]): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport Formatter from \".\"\r\n\r\ntype DiffAOA = (string | (string | null)[])[][]\r\n\r\nexport class HTML extends Formatter<string> {\r\n format(diffAOA: DiffAOA): string {\r\n // TODO: Implement HTML formatting\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";AAMA,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAAwB;AAC3B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;;;AC/BO,IAAM,OAAN,cAAmB,UAAkB;AAAA,EACxC,OAAO,SAA0B;AAE7B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;","names":[]} | ||
| {"version":3,"sources":["../../src/formatter/index.ts","../../src/formatter/html.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\nimport DiffAOA from \"../DiffAOA\"\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param diffAOA - The diff array of arrays to be formatted.\r\n * @returns The formatted string.\r\n */\r\n format(diffAOA: DiffAOA<T>): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport Formatter from \".\"\r\nimport fs from \"fs\"\r\nimport escapeHTML from \"escape-html\"\r\nimport DiffAOA from \"../DiffAOA\"\r\nimport path from \"path\"\r\n\r\nexport class HTML extends Formatter<string> {\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `<span style=\"background:#ffbbbb;\"><s>${actual}</s></span>`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `<span style=\"background:#bbffbb;\">${expected}</span>`\r\n return patchedString\r\n }\r\n ) {\r\n super(patcher)\r\n this.patch = patcher\r\n }\r\n format(diffAOA: DiffAOA<string>): string {\r\n const script = fs.readFileSync(path.resolve(__dirname, \"./script.js\"), \"utf8\");\r\n const patchedAOA = diffAOA.map((row) => {\r\n return row.map((cell) => {\r\n if (Array.isArray(cell)) {\r\n return this.patch(cell[0], cell[1])\r\n }\r\n return cell;\r\n });\r\n })\r\n return `\r\n <div id=\"spread-diff-patch\">\r\n <style>\r\n * {\r\n box-sizing: border-box;\r\n margin: 0;\r\n padding: 0;\r\n }\r\n </style>\r\n <div id=\"spread-diff-patch-data\" data-raw-diffAOA='${escapeHTML(JSON.stringify(patchedAOA))}'></div>\r\n <script src=\"https://unpkg.com/canvas-datagrid\"></script>\r\n <script>\r\n ${script}\r\n </script>\r\n </div>\r\n `\r\n }\r\n}"],"mappings":";AAQA,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAA6B;AAChC,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;;;ACpCA,OAAO,QAAQ;AACf,OAAO,gBAAgB;AAEvB,OAAO,UAAU;AAEV,IAAM,OAAN,cAAmB,UAAkB;AAAA,EACxC,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,wCAAwC,MAAM;AACnE,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,qCAAqC,QAAQ;AAClE,WAAO;AAAA,EACX,GACF;AACE,UAAM,OAAO;AACb,SAAK,QAAQ;AAAA,EACjB;AAAA,EACA,OAAO,SAAkC;AACrC,UAAM,SAAS,GAAG,aAAa,KAAK,QAAQ,WAAW,aAAa,GAAG,MAAM;AAC7E,UAAM,aAAa,QAAQ,IAAI,CAAC,QAAQ;AACpC,aAAO,IAAI,IAAI,CAAC,SAAS;AACrB,YAAI,MAAM,QAAQ,IAAI,GAAG;AACrB,iBAAO,KAAK,MAAM,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;AAAA,QACtC;AACA,eAAO;AAAA,MACX,CAAC;AAAA,IACL,CAAC;AACD,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iEASkD,WAAW,KAAK,UAAU,UAAU,CAAC,CAAC;AAAA;AAAA;AAAA,kBAGrF,MAAM;AAAA;AAAA;AAAA;AAAA,EAIpB;AACJ;","names":[]} |
@@ -1,20 +0,1 @@ | ||
| /** | ||
| * Represents a Formatter class. | ||
| * @template T - The type parameter for the Formatter class. | ||
| */ | ||
| declare class Formatter<T> { | ||
| patch: (actual: string | null, expected: string | null) => string; | ||
| /** | ||
| * Creates an instance of Formatter. | ||
| * @param {Function} patcher - The patcher function used to generate the patched string. | ||
| */ | ||
| constructor(patcher?: (actual: string | null, expected: string | null) => string); | ||
| /** | ||
| * Formats the diff array of arrays. | ||
| * @param {T[][]} diffAOA - The diff array of arrays to be formatted. | ||
| * @returns {string} The formatted string. | ||
| */ | ||
| format(diffAOA: T[][]): string; | ||
| } | ||
| export { Formatter as default }; | ||
| export { F as default } from '../DiffAOA-mlvW9HLo.mjs'; |
@@ -1,20 +0,1 @@ | ||
| /** | ||
| * Represents a Formatter class. | ||
| * @template T - The type parameter for the Formatter class. | ||
| */ | ||
| declare class Formatter<T> { | ||
| patch: (actual: string | null, expected: string | null) => string; | ||
| /** | ||
| * Creates an instance of Formatter. | ||
| * @param {Function} patcher - The patcher function used to generate the patched string. | ||
| */ | ||
| constructor(patcher?: (actual: string | null, expected: string | null) => string); | ||
| /** | ||
| * Formats the diff array of arrays. | ||
| * @param {T[][]} diffAOA - The diff array of arrays to be formatted. | ||
| * @returns {string} The formatted string. | ||
| */ | ||
| format(diffAOA: T[][]): string; | ||
| } | ||
| export { Formatter as default }; | ||
| export { F as default } from '../DiffAOA-mlvW9HLo.js'; |
@@ -45,4 +45,4 @@ "use strict"; | ||
| * Formats the diff array of arrays. | ||
| * @param {T[][]} diffAOA - The diff array of arrays to be formatted. | ||
| * @returns {string} The formatted string. | ||
| * @param diffAOA - The diff array of arrays to be formatted. | ||
| * @returns The formatted string. | ||
| */ | ||
@@ -49,0 +49,0 @@ format(diffAOA) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/formatter/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param {T[][]} diffAOA - The diff array of arrays to be formatted.\r\n * @returns {string} The formatted string.\r\n */\r\n format(diffAOA: T[][]): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAAwB;AAC3B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;","names":[]} | ||
| {"version":3,"sources":["../../src/formatter/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\nimport DiffAOA from \"../DiffAOA\"\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param diffAOA - The diff array of arrays to be formatted.\r\n * @returns The formatted string.\r\n */\r\n format(diffAOA: DiffAOA<T>): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAA6B;AAChC,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;","names":[]} |
@@ -21,4 +21,4 @@ // src/formatter/index.ts | ||
| * Formats the diff array of arrays. | ||
| * @param {T[][]} diffAOA - The diff array of arrays to be formatted. | ||
| * @returns {string} The formatted string. | ||
| * @param diffAOA - The diff array of arrays to be formatted. | ||
| * @returns The formatted string. | ||
| */ | ||
@@ -25,0 +25,0 @@ format(diffAOA) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/formatter/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param {T[][]} diffAOA - The diff array of arrays to be formatted.\r\n * @returns {string} The formatted string.\r\n */\r\n format(diffAOA: T[][]): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";AAMA,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAAwB;AAC3B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;","names":[]} | ||
| {"version":3,"sources":["../../src/formatter/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\nimport DiffAOA from \"../DiffAOA\"\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param diffAOA - The diff array of arrays to be formatted.\r\n * @returns The formatted string.\r\n */\r\n format(diffAOA: DiffAOA<T>): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";AAQA,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAA6B;AAChC,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;","names":[]} |
@@ -1,2 +0,2 @@ | ||
| import Formatter from './index.mjs'; | ||
| import { F as Formatter } from '../DiffAOA-mlvW9HLo.mjs'; | ||
@@ -3,0 +3,0 @@ type DiffAOA = (string | (string | null)[])[][]; |
@@ -1,2 +0,2 @@ | ||
| import Formatter from './index.js'; | ||
| import { F as Formatter } from '../DiffAOA-mlvW9HLo.js'; | ||
@@ -3,0 +3,0 @@ type DiffAOA = (string | (string | null)[])[][]; |
@@ -47,4 +47,4 @@ "use strict"; | ||
| * Formats the diff array of arrays. | ||
| * @param {T[][]} diffAOA - The diff array of arrays to be formatted. | ||
| * @returns {string} The formatted string. | ||
| * @param diffAOA - The diff array of arrays to be formatted. | ||
| * @returns The formatted string. | ||
| */ | ||
@@ -51,0 +51,0 @@ format(diffAOA) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/formatter/json.ts","../../src/formatter/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport Formatter from \".\"\r\n\r\ntype DiffAOA = (string | (string | null)[])[][]\r\n\r\nexport class JSON extends Formatter<string> {\r\n format(diffAOA: DiffAOA): string {\r\n // TODO: Implement JSON formatting\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param {T[][]} diffAOA - The diff array of arrays to be formatted.\r\n * @returns {string} The formatted string.\r\n */\r\n format(diffAOA: T[][]): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMA,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAAwB;AAC3B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;;;AD/BO,IAAM,OAAN,cAAmB,UAAkB;AAAA,EACxC,OAAO,SAA0B;AAE7B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;","names":[]} | ||
| {"version":3,"sources":["../../src/formatter/json.ts","../../src/formatter/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport Formatter from \".\"\r\n\r\ntype DiffAOA = (string | (string | null)[])[][]\r\n\r\nexport class JSON extends Formatter<string> {\r\n format(diffAOA: DiffAOA): string {\r\n // TODO: Implement JSON formatting\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\nimport DiffAOA from \"../DiffAOA\"\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param diffAOA - The diff array of arrays to be formatted.\r\n * @returns The formatted string.\r\n */\r\n format(diffAOA: DiffAOA<T>): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQA,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAA6B;AAChC,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;;;ADjCO,IAAM,OAAN,cAAmB,UAAkB;AAAA,EACxC,OAAO,SAA0B;AAE7B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;","names":[]} |
@@ -21,4 +21,4 @@ // src/formatter/index.ts | ||
| * Formats the diff array of arrays. | ||
| * @param {T[][]} diffAOA - The diff array of arrays to be formatted. | ||
| * @returns {string} The formatted string. | ||
| * @param diffAOA - The diff array of arrays to be formatted. | ||
| * @returns The formatted string. | ||
| */ | ||
@@ -25,0 +25,0 @@ format(diffAOA) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/formatter/index.ts","../../src/formatter/json.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param {T[][]} diffAOA - The diff array of arrays to be formatted.\r\n * @returns {string} The formatted string.\r\n */\r\n format(diffAOA: T[][]): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport Formatter from \".\"\r\n\r\ntype DiffAOA = (string | (string | null)[])[][]\r\n\r\nexport class JSON extends Formatter<string> {\r\n format(diffAOA: DiffAOA): string {\r\n // TODO: Implement JSON formatting\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";AAMA,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAAwB;AAC3B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;;;AC/BO,IAAM,OAAN,cAAmB,UAAkB;AAAA,EACxC,OAAO,SAA0B;AAE7B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;","names":[]} | ||
| {"version":3,"sources":["../../src/formatter/index.ts","../../src/formatter/json.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\n\r\nimport DiffAOA from \"../DiffAOA\"\r\n\r\n/**\r\n * Represents a Formatter class.\r\n * @template T - The type parameter for the Formatter class.\r\n */\r\nexport default class Formatter<T> {\r\n patch: (actual: string | null, expected: string | null) => string\r\n\r\n /**\r\n * Creates an instance of Formatter.\r\n * @param {Function} patcher - The patcher function used to generate the patched string.\r\n */\r\n constructor(\r\n patcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff array of arrays.\r\n * @param diffAOA - The diff array of arrays to be formatted.\r\n * @returns The formatted string.\r\n */\r\n format(diffAOA: DiffAOA<T>): string {\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}","/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport Formatter from \".\"\r\n\r\ntype DiffAOA = (string | (string | null)[])[][]\r\n\r\nexport class JSON extends Formatter<string> {\r\n format(diffAOA: DiffAOA): string {\r\n // TODO: Implement JSON formatting\r\n throw new Error(\"Method not implemented.\");\r\n }\r\n}"],"mappings":";AAQA,IAAqB,YAArB,MAAkC;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAuB,aAA4B;AAC1D,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,SAA6B;AAChC,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;;;ACjCO,IAAM,OAAN,cAAmB,UAAkB;AAAA,EACxC,OAAO,SAA0B;AAE7B,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC7C;AACJ;","names":[]} |
@@ -1,3 +0,25 @@ | ||
| import 'xlsx'; | ||
| export { W as WorkbookFormatter } from '../workbook-BYxHbFy7.mjs'; | ||
| import './index.mjs'; | ||
| import { WorkBook } from 'xlsx'; | ||
| import { D as DiffAOA } from '../DiffAOA-mlvW9HLo.mjs'; | ||
| /** | ||
| * Represents a formatter for a workbook. | ||
| * @template T - The type of data in the workbook. | ||
| */ | ||
| declare class WorkbookFormatter<T> { | ||
| patch: (actual: T | null, expected: T | null) => string; | ||
| /** | ||
| * Creates a new instance of WorkbookFormatter. | ||
| * @param patcher - A function that generates the patch string for a given actual and expected value. | ||
| */ | ||
| constructor(patcher?: (actual: T | null, expected: T | null) => string); | ||
| /** | ||
| * Formats the diff sheets of the workbook. | ||
| * @param diffSheets - An object representing the diff sheets. | ||
| * @returns The formatted workbook. | ||
| */ | ||
| format(diffSheets: { | ||
| [sheet: string]: DiffAOA<T>; | ||
| }): WorkBook; | ||
| } | ||
| export { WorkbookFormatter }; |
@@ -1,3 +0,25 @@ | ||
| import 'xlsx'; | ||
| export { W as WorkbookFormatter } from '../workbook-CVjI4Nft.js'; | ||
| import './index.js'; | ||
| import { WorkBook } from 'xlsx'; | ||
| import { D as DiffAOA } from '../DiffAOA-mlvW9HLo.js'; | ||
| /** | ||
| * Represents a formatter for a workbook. | ||
| * @template T - The type of data in the workbook. | ||
| */ | ||
| declare class WorkbookFormatter<T> { | ||
| patch: (actual: T | null, expected: T | null) => string; | ||
| /** | ||
| * Creates a new instance of WorkbookFormatter. | ||
| * @param patcher - A function that generates the patch string for a given actual and expected value. | ||
| */ | ||
| constructor(patcher?: (actual: T | null, expected: T | null) => string); | ||
| /** | ||
| * Formats the diff sheets of the workbook. | ||
| * @param diffSheets - An object representing the diff sheets. | ||
| * @returns The formatted workbook. | ||
| */ | ||
| format(diffSheets: { | ||
| [sheet: string]: DiffAOA<T>; | ||
| }): WorkBook; | ||
| } | ||
| export { WorkbookFormatter }; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/formatter/workbook.ts"],"sourcesContent":["import { WorkBook, utils } from \"xlsx\";\r\nimport DiffAOA from \"../DIffAOA\";\r\n\r\n/**\r\n * Represents a formatter for a workbook.\r\n * @template T - The type of data in the workbook.\r\n */\r\nexport class WorkbookFormatter<T> {\r\n patch: (actual: T | null, expected: T | null) => string\r\n\r\n /**\r\n * Creates a new instance of WorkbookFormatter.\r\n * @param patcher - A function that generates the patch string for a given actual and expected value.\r\n */\r\n constructor(\r\n patcher = (actual: T | null, expected: T | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff sheets of the workbook.\r\n * @param diffSheets - An object representing the diff sheets.\r\n * @returns The formatted workbook.\r\n */\r\n format(diffSheets: { [sheet: string]: DiffAOA<T> }): WorkBook {\r\n const diffWorkBook = utils.book_new()\r\n for (const sheet in diffSheets) {\r\n const patchedAOA = diffSheets[sheet].map((row) => {\r\n return row.map((cell) => Array.isArray(cell) ? this.patch(cell[0], cell[1]) : cell)\r\n })\r\n const ws = utils.aoa_to_sheet(patchedAOA)\r\n utils.book_append_sheet(diffWorkBook, ws, sheet)\r\n }\r\n return diffWorkBook\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgC;AAOzB,IAAM,oBAAN,MAA2B;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAkB,aAAuB;AAChD,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,YAAuD;AAC1D,UAAM,eAAe,kBAAM,SAAS;AACpC,eAAW,SAAS,YAAY;AAC5B,YAAM,aAAa,WAAW,KAAK,EAAE,IAAI,CAAC,QAAQ;AAC9C,eAAO,IAAI,IAAI,CAAC,SAAS,MAAM,QAAQ,IAAI,IAAI,KAAK,MAAM,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,IAAI;AAAA,MACtF,CAAC;AACD,YAAM,KAAK,kBAAM,aAAa,UAAU;AACxC,wBAAM,kBAAkB,cAAc,IAAI,KAAK;AAAA,IACnD;AACA,WAAO;AAAA,EACX;AACJ;","names":[]} | ||
| {"version":3,"sources":["../../src/formatter/workbook.ts"],"sourcesContent":["import { WorkBook, utils } from \"xlsx\";\r\nimport DiffAOA from \"../DiffAOA\";\r\n\r\n/**\r\n * Represents a formatter for a workbook.\r\n * @template T - The type of data in the workbook.\r\n */\r\nexport class WorkbookFormatter<T> {\r\n patch: (actual: T | null, expected: T | null) => string\r\n\r\n /**\r\n * Creates a new instance of WorkbookFormatter.\r\n * @param patcher - A function that generates the patch string for a given actual and expected value.\r\n */\r\n constructor(\r\n patcher = (actual: T | null, expected: T | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff sheets of the workbook.\r\n * @param diffSheets - An object representing the diff sheets.\r\n * @returns The formatted workbook.\r\n */\r\n format(diffSheets: { [sheet: string]: DiffAOA<T> }): WorkBook {\r\n const diffWorkBook = utils.book_new()\r\n for (const sheet in diffSheets) {\r\n const patchedAOA = diffSheets[sheet].map((row) => {\r\n return row.map((cell) => Array.isArray(cell) ? this.patch(cell[0], cell[1]) : cell)\r\n })\r\n const ws = utils.aoa_to_sheet(patchedAOA)\r\n utils.book_append_sheet(diffWorkBook, ws, sheet)\r\n }\r\n return diffWorkBook\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgC;AAOzB,IAAM,oBAAN,MAA2B;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAkB,aAAuB;AAChD,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,YAAuD;AAC1D,UAAM,eAAe,kBAAM,SAAS;AACpC,eAAW,SAAS,YAAY;AAC5B,YAAM,aAAa,WAAW,KAAK,EAAE,IAAI,CAAC,QAAQ;AAC9C,eAAO,IAAI,IAAI,CAAC,SAAS,MAAM,QAAQ,IAAI,IAAI,KAAK,MAAM,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,IAAI;AAAA,MACtF,CAAC;AACD,YAAM,KAAK,kBAAM,aAAa,UAAU;AACxC,wBAAM,kBAAkB,cAAc,IAAI,KAAK;AAAA,IACnD;AACA,WAAO;AAAA,EACX;AACJ;","names":[]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../src/formatter/workbook.ts"],"sourcesContent":["import { WorkBook, utils } from \"xlsx\";\r\nimport DiffAOA from \"../DIffAOA\";\r\n\r\n/**\r\n * Represents a formatter for a workbook.\r\n * @template T - The type of data in the workbook.\r\n */\r\nexport class WorkbookFormatter<T> {\r\n patch: (actual: T | null, expected: T | null) => string\r\n\r\n /**\r\n * Creates a new instance of WorkbookFormatter.\r\n * @param patcher - A function that generates the patch string for a given actual and expected value.\r\n */\r\n constructor(\r\n patcher = (actual: T | null, expected: T | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff sheets of the workbook.\r\n * @param diffSheets - An object representing the diff sheets.\r\n * @returns The formatted workbook.\r\n */\r\n format(diffSheets: { [sheet: string]: DiffAOA<T> }): WorkBook {\r\n const diffWorkBook = utils.book_new()\r\n for (const sheet in diffSheets) {\r\n const patchedAOA = diffSheets[sheet].map((row) => {\r\n return row.map((cell) => Array.isArray(cell) ? this.patch(cell[0], cell[1]) : cell)\r\n })\r\n const ws = utils.aoa_to_sheet(patchedAOA)\r\n utils.book_append_sheet(diffWorkBook, ws, sheet)\r\n }\r\n return diffWorkBook\r\n }\r\n}\r\n"],"mappings":";AAAA,SAAmB,aAAa;AAOzB,IAAM,oBAAN,MAA2B;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAkB,aAAuB;AAChD,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,YAAuD;AAC1D,UAAM,eAAe,MAAM,SAAS;AACpC,eAAW,SAAS,YAAY;AAC5B,YAAM,aAAa,WAAW,KAAK,EAAE,IAAI,CAAC,QAAQ;AAC9C,eAAO,IAAI,IAAI,CAAC,SAAS,MAAM,QAAQ,IAAI,IAAI,KAAK,MAAM,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,IAAI;AAAA,MACtF,CAAC;AACD,YAAM,KAAK,MAAM,aAAa,UAAU;AACxC,YAAM,kBAAkB,cAAc,IAAI,KAAK;AAAA,IACnD;AACA,WAAO;AAAA,EACX;AACJ;","names":[]} | ||
| {"version":3,"sources":["../../src/formatter/workbook.ts"],"sourcesContent":["import { WorkBook, utils } from \"xlsx\";\r\nimport DiffAOA from \"../DiffAOA\";\r\n\r\n/**\r\n * Represents a formatter for a workbook.\r\n * @template T - The type of data in the workbook.\r\n */\r\nexport class WorkbookFormatter<T> {\r\n patch: (actual: T | null, expected: T | null) => string\r\n\r\n /**\r\n * Creates a new instance of WorkbookFormatter.\r\n * @param patcher - A function that generates the patch string for a given actual and expected value.\r\n */\r\n constructor(\r\n patcher = (actual: T | null, expected: T | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `[-][${actual}]`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `[+][${expected}]`\r\n return patchedString\r\n }\r\n ) {\r\n this.patch = patcher\r\n }\r\n\r\n /**\r\n * Formats the diff sheets of the workbook.\r\n * @param diffSheets - An object representing the diff sheets.\r\n * @returns The formatted workbook.\r\n */\r\n format(diffSheets: { [sheet: string]: DiffAOA<T> }): WorkBook {\r\n const diffWorkBook = utils.book_new()\r\n for (const sheet in diffSheets) {\r\n const patchedAOA = diffSheets[sheet].map((row) => {\r\n return row.map((cell) => Array.isArray(cell) ? this.patch(cell[0], cell[1]) : cell)\r\n })\r\n const ws = utils.aoa_to_sheet(patchedAOA)\r\n utils.book_append_sheet(diffWorkBook, ws, sheet)\r\n }\r\n return diffWorkBook\r\n }\r\n}\r\n"],"mappings":";AAAA,SAAmB,aAAa;AAOzB,IAAM,oBAAN,MAA2B;AAAA;AAAA;AAAA;AAAA;AAAA,EAO9B,YACI,UAAU,CAAC,QAAkB,aAAuB;AAChD,QAAI,gBAAgB;AACpB,QAAI;AACA,uBAAiB,OAAO,MAAM;AAClC,QAAI,UAAU;AACV,uBAAiB;AACrB,QAAI;AACA,uBAAiB,OAAO,QAAQ;AACpC,WAAO;AAAA,EACX,GACF;AACE,SAAK,QAAQ;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,YAAuD;AAC1D,UAAM,eAAe,MAAM,SAAS;AACpC,eAAW,SAAS,YAAY;AAC5B,YAAM,aAAa,WAAW,KAAK,EAAE,IAAI,CAAC,QAAQ;AAC9C,eAAO,IAAI,IAAI,CAAC,SAAS,MAAM,QAAQ,IAAI,IAAI,KAAK,MAAM,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,IAAI;AAAA,MACtF,CAAC;AACD,YAAM,KAAK,MAAM,aAAa,UAAU;AACxC,YAAM,kBAAkB,cAAc,IAAI,KAAK;AAAA,IACnD;AACA,WAAO;AAAA,EACX;AACJ;","names":[]} |
+2
-2
@@ -1,5 +0,5 @@ | ||
| import { D as DiffAOA, W as WorkbookFormatter } from './workbook-BYxHbFy7.mjs'; | ||
| import { D as DiffAOA } from './DiffAOA-mlvW9HLo.mjs'; | ||
| import * as xlsx from 'xlsx'; | ||
| import xlsx__default, { WorkBook } from 'xlsx'; | ||
| import './formatter/index.mjs'; | ||
| import { WorkbookFormatter } from './formatter/workbook.mjs'; | ||
@@ -6,0 +6,0 @@ /** |
+2
-2
@@ -1,5 +0,5 @@ | ||
| import { D as DiffAOA, W as WorkbookFormatter } from './workbook-CVjI4Nft.js'; | ||
| import { D as DiffAOA } from './DiffAOA-mlvW9HLo.js'; | ||
| import * as xlsx from 'xlsx'; | ||
| import xlsx__default, { WorkBook } from 'xlsx'; | ||
| import './formatter/index.js'; | ||
| import { WorkbookFormatter } from './formatter/workbook.js'; | ||
@@ -6,0 +6,0 @@ /** |
+3
-5
@@ -60,3 +60,3 @@ "use strict"; | ||
| // src/DIffAOA.ts | ||
| // src/DiffAOA.ts | ||
| var _diffCount; | ||
@@ -92,3 +92,3 @@ var DiffAOA = class extends Array { | ||
| _diffCount = new WeakMap(); | ||
| var DIffAOA_default = DiffAOA; | ||
| var DiffAOA_default = DiffAOA; | ||
@@ -138,3 +138,3 @@ // src/index.ts | ||
| var _a, _b, _c, _d, _e, _f, _g; | ||
| const diffAOA = new DIffAOA_default(); | ||
| const diffAOA = new DiffAOA_default(); | ||
| const maxRowCount = Math.max(actualAOA.length, expectedAOA.length); | ||
@@ -160,4 +160,2 @@ for (let i = 0; i < maxRowCount; i += 1) { | ||
| patchedString += `(-)(${actual})`; | ||
| if (actual && expected) | ||
| patchedString += " "; | ||
| if (expected) | ||
@@ -164,0 +162,0 @@ patchedString += `(+)(${expected})`; |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../src/index.ts","../src/DIffAOA.ts","../src/DiffWorkBook.ts"],"sourcesContent":["import Papa from \"papaparse\";\r\nimport fs from 'fs';\r\nimport DiffAOA from \"./DIffAOA\";\r\nimport xlsx, { WorkBook, utils } from 'xlsx';\r\nimport DiffWorkBook from \"./DiffWorkBook\";\r\n\r\n/**\r\n * Reads a CSV file and parses its content into a two-dimensional array.\r\n * @param filePath - The path to the CSV file.\r\n * @returns A two-dimensional array representing the parsed CSV data.\r\n * @template T - The type of data in the CSV file.\r\n */\r\nexport function readCSV<T>(filePath: string): T[][] {\r\n return Papa.parse<T[]>(fs.readFileSync(filePath, \"utf8\")).data || [];\r\n}\r\n/**\r\n * Reads a workbook from the specified file path.\r\n * @param filePath - The path to the workbook file.\r\n * @returns The parsed workbook object.\r\n */\r\nexport function readWorkBook(filePath: string) {\r\n return xlsx.readFile(filePath)\r\n}\r\n\r\n/**\r\n * Compares two arrays of arrays (AOA) and identifies differences based on a custom comparator function.\r\n * @param actualAOA - The actual array of arrays.\r\n * @param expectedAOA - The expected array of arrays for comparison.\r\n * @param comparator - A function to compare individual elements in the arrays (default is a simple !== comparison).\r\n * @returns An instance of DiffAOA<T> representing the differences between the two arrays of arrays.\r\n * @template T - The type of data in the arrays of arrays.\r\n */\r\nexport function diff<T>(\r\n actualAOA: T[][],\r\n expectedAOA: T[][],\r\n comparator: (actual: T, expected: T) => boolean = (actual, expected) => actual !== expected\r\n): DiffAOA<T> {\r\n const diffAOA: DiffAOA<T> = new DiffAOA();\r\n const maxRowCount = Math.max(actualAOA.length, expectedAOA.length);\r\n\r\n for (let i = 0; i < maxRowCount; i += 1) {\r\n const diffRow: (T | (T | null)[])[] = [];\r\n const maxColCount = Math.max(actualAOA?.[i]?.length || 0, expectedAOA?.[i]?.length || 0);\r\n\r\n for (let j = 0; j < maxColCount; j += 1) {\r\n if (comparator(actualAOA?.[i]?.[j], expectedAOA?.[i]?.[j])) {\r\n diffAOA.diffCount += 1;\r\n diffRow[j] = [actualAOA?.[i]?.[j], expectedAOA?.[i]?.[j]];\r\n } else {\r\n diffRow[j] = expectedAOA?.[i]?.[j];\r\n }\r\n }\r\n\r\n diffAOA.push(diffRow);\r\n }\r\n return diffAOA;\r\n}\r\n\r\n/**\r\n * Calculates the difference between two workbooks.\r\n * @template T - The type of the elements in the workbooks.\r\n * @param actualWorkBook - The actual workbook.\r\n * @param expectedWorkBook - The expected workbook.\r\n * @param comparator - The comparator function to compare elements in the workbooks. Defaults to a function that checks for inequality.\r\n * @param sheetPatcher - The function to generate a patched string for sheet names. Defaults to a function that generates a string with added and removed sheet names.\r\n * @returns - The diff workbook containing the differences between the two workbooks.\r\n */\r\nexport function diffWorkBook<T>(\r\n actualWorkBook: WorkBook,\r\n expectedWorkBook: WorkBook,\r\n comparator: (actual: T, expected: T) => boolean = (actual, expected) => actual !== expected,\r\n sheetPatcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `(-)(${actual})`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `(+)(${expected})`\r\n return patchedString\r\n }\r\n) {\r\n const diffWorkBook: DiffWorkBook<T> = new DiffWorkBook()\r\n const actualSheets = actualWorkBook.SheetNames\r\n const expectedSheets = expectedWorkBook.SheetNames\r\n const maxSheetCount = Math.max(actualSheets?.length || 0, expectedSheets?.length || 0)\r\n for (let i = 0; i < maxSheetCount; i += 1) {\r\n if (comparator(actualSheets?.[i] as T, expectedSheets?.[i] as T)) {\r\n const actualPatchedSheet = sheetPatcher(actualSheets?.[i],null)\r\n diffWorkBook.sheets[actualPatchedSheet] = diff<T>(\r\n utils.sheet_to_json(actualWorkBook.Sheets[actualSheets?.[i]], { header: 1 }),\r\n [],\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[actualPatchedSheet].diffCount\r\n const expectedPatchedSheet = sheetPatcher(null,expectedSheets?.[i])\r\n diffWorkBook.sheets[expectedPatchedSheet] = diff<T>(\r\n [],\r\n utils.sheet_to_json(expectedWorkBook.Sheets[expectedSheets?.[i]], { header: 1 }),\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[expectedPatchedSheet].diffCount\r\n }\r\n else {\r\n diffWorkBook.sheets[expectedSheets[i]] = diff<T>(\r\n utils.sheet_to_json(actualWorkBook.Sheets[actualSheets?.[i]], { header: 1 }),\r\n utils.sheet_to_json(expectedWorkBook.Sheets[expectedSheets?.[i]], { header: 1 }),\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[expectedSheets[i]].diffCount\r\n }\r\n }\r\n return diffWorkBook\r\n}","import Formatter from \"./formatter\";\r\n\r\n/**\r\n * Represents the differences between two arrays of arrays (AOA) with a customizable format.\r\n * @template T - The type of data in the arrays of arrays.\r\n */\r\nclass DiffAOA<T> extends Array<Array<T | Array<T | null>>> {\r\n #diffCount: number = 0;\r\n\r\n /**\r\n * Formats the differences using the provided formatter.\r\n * @param formatter - The formatter object responsible for generating the formatted string.\r\n * @returns The formatted string representing the differences.\r\n */\r\n format(formatter: Formatter<T>): string {\r\n return formatter.format(this as T[][]);\r\n }\r\n\r\n /**\r\n * Gets the count of differences in the array of arrays.\r\n * @returns The number of differences.\r\n */\r\n get diffCount() {\r\n return this.#diffCount;\r\n }\r\n\r\n /**\r\n * Sets the count of differences in the array of arrays.\r\n * @param value - The number of differences to set.\r\n */\r\n set diffCount(value: number) {\r\n this.#diffCount = value;\r\n }\r\n}\r\n\r\nexport default DiffAOA;","import DiffAOA from \"./DIffAOA\";\r\nimport { WorkbookFormatter } from \"./formatter/workbook\";\r\n/**\r\n * Represents a workbook that stores the differences between two workbooks.\r\n * @template T - The type of data stored in the workbook.\r\n */\r\nclass DiffWorkBook<T> {\r\n sheets: { [sheet: string]: DiffAOA<T>; };\r\n #diffCount: number = 0;\r\n\r\n constructor() {\r\n this.sheets = {};\r\n }\r\n\r\n /**\r\n * Formats the workbook using the specified formatter.\r\n * @param formatter - The formatter to use for formatting the workbook.\r\n * @returns The formatted workbook.\r\n */\r\n format(formatter: WorkbookFormatter<T>) {\r\n return formatter.format(this.sheets);\r\n }\r\n\r\n /**\r\n * Gets the number of differences in the workbook.\r\n */\r\n get diffCount() {\r\n return this.#diffCount;\r\n }\r\n\r\n /**\r\n * Sets the number of differences in the workbook.\r\n */\r\n set diffCount(value: number) {\r\n this.#diffCount = value;\r\n }\r\n}\r\n\r\nexport default DiffWorkBook;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAiB;AACjB,gBAAe;;;ACDf;AAMA,IAAM,UAAN,cAAyB,MAAkC;AAAA,EAA3D;AAAA;AACI,mCAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrB,OAAO,WAAiC;AACpC,WAAO,UAAU,OAAO,IAAa;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,YAAY;AACZ,WAAO,mBAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,UAAU,OAAe;AACzB,uBAAK,YAAa;AAAA,EACtB;AACJ;AA1BI;AA4BJ,IAAO,kBAAQ;;;ADhCf,kBAAsC;;;AEHtC,IAAAA;AAMA,IAAM,eAAN,MAAsB;AAAA,EAIlB,cAAc;AAFd,uBAAAA,a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,iBAAiB,OAAO,iDAAiB,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAAA,QAC/E;AAAA,MACJ;AACA,MAAAA,cAAa,aAAaA,cAAa,OAAO,eAAe,CAAC,CAAC,EAAE;AAAA,IACrE;AAAA,EACJ;AACA,SAAOA;AACX;","names":["_diffCount","Papa","fs","xlsx","diffWorkBook"]} | ||
| {"version":3,"sources":["../src/index.ts","../src/DiffAOA.ts","../src/DiffWorkBook.ts"],"sourcesContent":["import Papa from \"papaparse\";\r\nimport fs from 'fs';\r\nimport DiffAOA from \"./DiffAOA\";\r\nimport xlsx, { WorkBook, utils } from 'xlsx';\r\nimport DiffWorkBook from \"./DiffWorkBook\";\r\n\r\n/**\r\n * Reads a CSV file and parses its content into a two-dimensional array.\r\n * @param filePath - The path to the CSV file.\r\n * @returns A two-dimensional array representing the parsed CSV data.\r\n * @template T - The type of data in the CSV file.\r\n */\r\nexport function readCSV<T>(filePath: string): T[][] {\r\n return Papa.parse<T[]>(fs.readFileSync(filePath, \"utf8\")).data || [];\r\n}\r\n/**\r\n * Reads a workbook from the specified file path.\r\n * @param filePath - The path to the workbook file.\r\n * @returns The parsed workbook object.\r\n */\r\nexport function readWorkBook(filePath: string) {\r\n return xlsx.readFile(filePath)\r\n}\r\n\r\n/**\r\n * Compares two arrays of arrays (AOA) and identifies differences based on a custom comparator function.\r\n * @param actualAOA - The actual array of arrays.\r\n * @param expectedAOA - The expected array of arrays for comparison.\r\n * @param comparator - A function to compare individual elements in the arrays (default is a simple !== comparison).\r\n * @returns An instance of DiffAOA<T> representing the differences between the two arrays of arrays.\r\n * @template T - The type of data in the arrays of arrays.\r\n */\r\nexport function diff<T>(\r\n actualAOA: T[][],\r\n expectedAOA: T[][],\r\n comparator: (actual: T, expected: T) => boolean = (actual, expected) => actual !== expected\r\n): DiffAOA<T> {\r\n const diffAOA: DiffAOA<T> = new DiffAOA();\r\n const maxRowCount = Math.max(actualAOA.length, expectedAOA.length);\r\n\r\n for (let i = 0; i < maxRowCount; i += 1) {\r\n const diffRow: (T | (T | null)[])[] = [];\r\n const maxColCount = Math.max(actualAOA?.[i]?.length || 0, expectedAOA?.[i]?.length || 0);\r\n\r\n for (let j = 0; j < maxColCount; j += 1) {\r\n if (comparator(actualAOA?.[i]?.[j], expectedAOA?.[i]?.[j])) {\r\n diffAOA.diffCount += 1;\r\n diffRow[j] = [actualAOA?.[i]?.[j], expectedAOA?.[i]?.[j]];\r\n } else {\r\n diffRow[j] = expectedAOA?.[i]?.[j];\r\n }\r\n }\r\n\r\n diffAOA.push(diffRow);\r\n }\r\n return diffAOA;\r\n}\r\n\r\n/**\r\n * Calculates the difference between two workbooks.\r\n * @template T - The type of the elements in the workbooks.\r\n * @param actualWorkBook - The actual workbook.\r\n * @param expectedWorkBook - The expected workbook.\r\n * @param comparator - The comparator function to compare elements in the workbooks. Defaults to a function that checks for inequality.\r\n * @param sheetPatcher - The function to generate a patched string for sheet names. Defaults to a function that generates a string with added and removed sheet names.\r\n * @returns - The diff workbook containing the differences between the two workbooks.\r\n */\r\nexport function diffWorkBook<T>(\r\n actualWorkBook: WorkBook,\r\n expectedWorkBook: WorkBook,\r\n comparator: (actual: T, expected: T) => boolean = (actual, expected) => actual !== expected,\r\n sheetPatcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `(-)(${actual})`\r\n if (expected)\r\n patchedString += `(+)(${expected})`\r\n return patchedString\r\n }\r\n) {\r\n const diffWorkBook: DiffWorkBook<T> = new DiffWorkBook()\r\n const actualSheets = actualWorkBook.SheetNames\r\n const expectedSheets = expectedWorkBook.SheetNames\r\n const maxSheetCount = Math.max(actualSheets?.length || 0, expectedSheets?.length || 0)\r\n for (let i = 0; i < maxSheetCount; i += 1) {\r\n if (comparator(actualSheets?.[i] as T, expectedSheets?.[i] as T)) {\r\n const actualPatchedSheet = sheetPatcher(actualSheets?.[i],null)\r\n diffWorkBook.sheets[actualPatchedSheet] = diff<T>(\r\n utils.sheet_to_json(actualWorkBook.Sheets[actualSheets?.[i]], { header: 1 }),\r\n [],\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[actualPatchedSheet].diffCount\r\n const expectedPatchedSheet = sheetPatcher(null,expectedSheets?.[i])\r\n diffWorkBook.sheets[expectedPatchedSheet] = diff<T>(\r\n [],\r\n utils.sheet_to_json(expectedWorkBook.Sheets[expectedSheets?.[i]], { header: 1 }),\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[expectedPatchedSheet].diffCount\r\n }\r\n else {\r\n diffWorkBook.sheets[expectedSheets[i]] = diff<T>(\r\n utils.sheet_to_json(actualWorkBook.Sheets[actualSheets?.[i]], { header: 1 }),\r\n utils.sheet_to_json(expectedWorkBook.Sheets[expectedSheets?.[i]], { header: 1 }),\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[expectedSheets[i]].diffCount\r\n }\r\n }\r\n return diffWorkBook\r\n}","import Formatter from \"./formatter\";\r\n\r\n/**\r\n * Represents the differences between two arrays of arrays (AOA) with a customizable format.\r\n * @template T - The type of data in the arrays of arrays.\r\n */\r\nclass DiffAOA<T> extends Array<Array<T | Array<T | null>>> {\r\n #diffCount: number = 0;\r\n\r\n /**\r\n * Formats the differences using the provided formatter.\r\n * @param formatter - The formatter object responsible for generating the formatted string.\r\n * @returns The formatted string representing the differences.\r\n */\r\n format(formatter: Formatter<T>): string {\r\n return formatter.format(this as DiffAOA<T>);\r\n }\r\n\r\n /**\r\n * Gets the count of differences in the array of arrays.\r\n * @returns The number of differences.\r\n */\r\n get diffCount() {\r\n return this.#diffCount;\r\n }\r\n\r\n /**\r\n * Sets the count of differences in the array of arrays.\r\n * @param value - The number of differences to set.\r\n */\r\n set diffCount(value: number) {\r\n this.#diffCount = value;\r\n }\r\n}\r\n\r\nexport default DiffAOA;","import DiffAOA from \"./DiffAOA\";\r\nimport { WorkbookFormatter } from \"./formatter/workbook\";\r\n/**\r\n * Represents a workbook that stores the differences between two workbooks.\r\n * @template T - The type of data stored in the workbook.\r\n */\r\nclass DiffWorkBook<T> {\r\n sheets: { [sheet: string]: DiffAOA<T>; };\r\n #diffCount: number = 0;\r\n\r\n constructor() {\r\n this.sheets = {};\r\n }\r\n\r\n /**\r\n * Formats the workbook using the specified formatter.\r\n * @param formatter - The formatter to use for formatting the workbook.\r\n * @returns The formatted workbook.\r\n */\r\n format(formatter: WorkbookFormatter<T>) {\r\n return formatter.format(this.sheets);\r\n }\r\n\r\n /**\r\n * Gets the number of differences in the workbook.\r\n */\r\n get diffCount() {\r\n return this.#diffCount;\r\n }\r\n\r\n /**\r\n * Sets the number of differences in the workbook.\r\n */\r\n set diffCount(value: number) {\r\n this.#diffCount = value;\r\n }\r\n}\r\n\r\nexport default DiffWorkBook;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAiB;AACjB,gBAAe;;;ACDf;AAMA,IAAM,UAAN,cAAyB,MAAkC;AAAA,EAA3D;AAAA;AACI,mCAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrB,OAAO,WAAiC;AACpC,WAAO,UAAU,OAAO,IAAkB;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,YAAY;AACZ,WAAO,mBAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,UAAU,OAAe;AACzB,uBAAK,YAAa;AAAA,EACtB;AACJ;AA1BI;AA4BJ,IAAO,kBAAQ;;;ADhCf,kBAAsC;;;AEHtC,IAAAA;AAMA,IAAM,eAAN,MAAsB;AAAA,EAIlB,cAAc;AAFd,uBAAAA,aAAqB;AAGjB,SAAK,SAAS,CAAC;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,WAAiC;AACpC,WAAO,UAAU,OAAO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,IACrE;AAAA,EACJ;AACA,SAAOA;AACX;","names":["_diffCount","Papa","fs","xlsx","diffWorkBook"]} |
+3
-5
@@ -24,3 +24,3 @@ var __accessCheck = (obj, member, msg) => { | ||
| // src/DIffAOA.ts | ||
| // src/DiffAOA.ts | ||
| var _diffCount; | ||
@@ -56,3 +56,3 @@ var DiffAOA = class extends Array { | ||
| _diffCount = new WeakMap(); | ||
| var DIffAOA_default = DiffAOA; | ||
| var DiffAOA_default = DiffAOA; | ||
@@ -102,3 +102,3 @@ // src/index.ts | ||
| var _a, _b, _c, _d, _e, _f, _g; | ||
| const diffAOA = new DIffAOA_default(); | ||
| const diffAOA = new DiffAOA_default(); | ||
| const maxRowCount = Math.max(actualAOA.length, expectedAOA.length); | ||
@@ -124,4 +124,2 @@ for (let i = 0; i < maxRowCount; i += 1) { | ||
| patchedString += `(-)(${actual})`; | ||
| if (actual && expected) | ||
| patchedString += " "; | ||
| if (expected) | ||
@@ -128,0 +126,0 @@ patchedString += `(+)(${expected})`; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../src/index.ts","../src/DIffAOA.ts","../src/DiffWorkBook.ts"],"sourcesContent":["import Papa from \"papaparse\";\r\nimport fs from 'fs';\r\nimport DiffAOA from \"./DIffAOA\";\r\nimport xlsx, { WorkBook, utils } from 'xlsx';\r\nimport DiffWorkBook from \"./DiffWorkBook\";\r\n\r\n/**\r\n * Reads a CSV file and parses its content into a two-dimensional array.\r\n * @param filePath - The path to the CSV file.\r\n * @returns A two-dimensional array representing the parsed CSV data.\r\n * @template T - The type of data in the CSV file.\r\n */\r\nexport function readCSV<T>(filePath: string): T[][] {\r\n return Papa.parse<T[]>(fs.readFileSync(filePath, \"utf8\")).data || [];\r\n}\r\n/**\r\n * Reads a workbook from the specified file path.\r\n * @param filePath - The path to the workbook file.\r\n * @returns The parsed workbook object.\r\n */\r\nexport function readWorkBook(filePath: string) {\r\n return xlsx.readFile(filePath)\r\n}\r\n\r\n/**\r\n * Compares two arrays of arrays (AOA) and identifies differences based on a custom comparator function.\r\n * @param actualAOA - The actual array of arrays.\r\n * @param expectedAOA - The expected array of arrays for comparison.\r\n * @param comparator - A function to compare individual elements in the arrays (default is a simple !== comparison).\r\n * @returns An instance of DiffAOA<T> representing the differences between the two arrays of arrays.\r\n * @template T - The type of data in the arrays of arrays.\r\n */\r\nexport function diff<T>(\r\n actualAOA: T[][],\r\n expectedAOA: T[][],\r\n comparator: (actual: T, expected: T) => boolean = (actual, expected) => actual !== expected\r\n): DiffAOA<T> {\r\n const diffAOA: DiffAOA<T> = new DiffAOA();\r\n const maxRowCount = Math.max(actualAOA.length, expectedAOA.length);\r\n\r\n for (let i = 0; i < maxRowCount; i += 1) {\r\n const diffRow: (T | (T | null)[])[] = [];\r\n const maxColCount = Math.max(actualAOA?.[i]?.length || 0, expectedAOA?.[i]?.length || 0);\r\n\r\n for (let j = 0; j < maxColCount; j += 1) {\r\n if (comparator(actualAOA?.[i]?.[j], expectedAOA?.[i]?.[j])) {\r\n diffAOA.diffCount += 1;\r\n diffRow[j] = [actualAOA?.[i]?.[j], expectedAOA?.[i]?.[j]];\r\n } else {\r\n diffRow[j] = expectedAOA?.[i]?.[j];\r\n }\r\n }\r\n\r\n diffAOA.push(diffRow);\r\n }\r\n return diffAOA;\r\n}\r\n\r\n/**\r\n * Calculates the difference between two workbooks.\r\n * @template T - The type of the elements in the workbooks.\r\n * @param actualWorkBook - The actual workbook.\r\n * @param expectedWorkBook - The expected workbook.\r\n * @param comparator - The comparator function to compare elements in the workbooks. Defaults to a function that checks for inequality.\r\n * @param sheetPatcher - The function to generate a patched string for sheet names. Defaults to a function that generates a string with added and removed sheet names.\r\n * @returns - The diff workbook containing the differences between the two workbooks.\r\n */\r\nexport function diffWorkBook<T>(\r\n actualWorkBook: WorkBook,\r\n expectedWorkBook: WorkBook,\r\n comparator: (actual: T, expected: T) => boolean = (actual, expected) => actual !== expected,\r\n sheetPatcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `(-)(${actual})`\r\n if (actual && expected)\r\n patchedString += \" \"\r\n if (expected)\r\n patchedString += `(+)(${expected})`\r\n return patchedString\r\n }\r\n) {\r\n const diffWorkBook: DiffWorkBook<T> = new DiffWorkBook()\r\n const actualSheets = actualWorkBook.SheetNames\r\n const expectedSheets = expectedWorkBook.SheetNames\r\n const maxSheetCount = Math.max(actualSheets?.length || 0, expectedSheets?.length || 0)\r\n for (let i = 0; i < maxSheetCount; i += 1) {\r\n if (comparator(actualSheets?.[i] as T, expectedSheets?.[i] as T)) {\r\n const actualPatchedSheet = sheetPatcher(actualSheets?.[i],null)\r\n diffWorkBook.sheets[actualPatchedSheet] = diff<T>(\r\n utils.sheet_to_json(actualWorkBook.Sheets[actualSheets?.[i]], { header: 1 }),\r\n [],\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[actualPatchedSheet].diffCount\r\n const expectedPatchedSheet = sheetPatcher(null,expectedSheets?.[i])\r\n diffWorkBook.sheets[expectedPatchedSheet] = diff<T>(\r\n [],\r\n utils.sheet_to_json(expectedWorkBook.Sheets[expectedSheets?.[i]], { header: 1 }),\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[expectedPatchedSheet].diffCount\r\n }\r\n else {\r\n diffWorkBook.sheets[expectedSheets[i]] = diff<T>(\r\n utils.sheet_to_json(actualWorkBook.Sheets[actualSheets?.[i]], { header: 1 }),\r\n utils.sheet_to_json(expectedWorkBook.Sheets[expectedSheets?.[i]], { header: 1 }),\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[expectedSheets[i]].diffCount\r\n }\r\n }\r\n return diffWorkBook\r\n}","import Formatter from \"./formatter\";\r\n\r\n/**\r\n * Represents the differences between two arrays of arrays (AOA) with a customizable format.\r\n * @template T - The type of data in the arrays of arrays.\r\n */\r\nclass DiffAOA<T> extends Array<Array<T | Array<T | null>>> {\r\n #diffCount: number = 0;\r\n\r\n /**\r\n * Formats the differences using the provided formatter.\r\n * @param formatter - The formatter object responsible for generating the formatted string.\r\n * @returns The formatted string representing the differences.\r\n */\r\n format(formatter: Formatter<T>): string {\r\n return formatter.format(this as T[][]);\r\n }\r\n\r\n /**\r\n * Gets the count of differences in the array of arrays.\r\n * @returns The number of differences.\r\n */\r\n get diffCount() {\r\n return this.#diffCount;\r\n }\r\n\r\n /**\r\n * Sets the count of differences in the array of arrays.\r\n * @param value - The number of differences to set.\r\n */\r\n set diffCount(value: number) {\r\n this.#diffCount = value;\r\n }\r\n}\r\n\r\nexport default DiffAOA;","import DiffAOA from \"./DIffAOA\";\r\nimport { WorkbookFormatter } from \"./formatter/workbook\";\r\n/**\r\n * Represents a workbook that stores the differences between two workbooks.\r\n * @template T - The type of data stored in the workbook.\r\n */\r\nclass DiffWorkBook<T> {\r\n sheets: { [sheet: string]: DiffAOA<T>; };\r\n #diffCount: number = 0;\r\n\r\n constructor() {\r\n this.sheets = {};\r\n }\r\n\r\n /**\r\n * Formats the workbook using the specified formatter.\r\n * @param formatter - The formatter to use for formatting the workbook.\r\n * @returns The formatted workbook.\r\n */\r\n format(formatter: WorkbookFormatter<T>) {\r\n return formatter.format(this.sheets);\r\n }\r\n\r\n /**\r\n * Gets the number of differences in the workbook.\r\n */\r\n get diffCount() {\r\n return this.#diffCount;\r\n }\r\n\r\n /**\r\n * Sets the number of differences in the workbook.\r\n */\r\n set diffCount(value: number) {\r\n this.#diffCount = value;\r\n }\r\n}\r\n\r\nexport default DiffWorkBook;"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,OAAO,QAAQ;;;ACDf;AAMA,IAAM,UAAN,cAAyB,MAAkC;AAAA,EAA3D;AAAA;AACI,mCAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrB,OAAO,WAAiC;AACpC,WAAO,UAAU,OAAO,IAAa;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,YAAY;A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A,MACJ;AACA,MAAAA,cAAa,aAAaA,cAAa,OAAO,oBAAoB,EAAE;AAAA,IACxE,OACK;AACD,MAAAA,cAAa,OAAO,eAAe,CAAC,CAAC,IAAI;AAAA,QACrC,MAAM,cAAc,eAAe,OAAO,6CAAe,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAAA,QAC3E,MAAM,cAAc,iBAAiB,OAAO,iDAAiB,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAAA,QAC/E;AAAA,MACJ;AACA,MAAAA,cAAa,aAAaA,cAAa,OAAO,eAAe,CAAC,CAAC,EAAE;AAAA,IACrE;AAAA,EACJ;AACA,SAAOA;AACX;","names":["_diffCount","diffWorkBook"]} | ||
| {"version":3,"sources":["../src/index.ts","../src/DiffAOA.ts","../src/DiffWorkBook.ts"],"sourcesContent":["import Papa from \"papaparse\";\r\nimport fs from 'fs';\r\nimport DiffAOA from \"./DiffAOA\";\r\nimport xlsx, { WorkBook, utils } from 'xlsx';\r\nimport DiffWorkBook from \"./DiffWorkBook\";\r\n\r\n/**\r\n * Reads a CSV file and parses its content into a two-dimensional array.\r\n * @param filePath - The path to the CSV file.\r\n * @returns A two-dimensional array representing the parsed CSV data.\r\n * @template T - The type of data in the CSV file.\r\n */\r\nexport function readCSV<T>(filePath: string): T[][] {\r\n return Papa.parse<T[]>(fs.readFileSync(filePath, \"utf8\")).data || [];\r\n}\r\n/**\r\n * Reads a workbook from the specified file path.\r\n * @param filePath - The path to the workbook file.\r\n * @returns The parsed workbook object.\r\n */\r\nexport function readWorkBook(filePath: string) {\r\n return xlsx.readFile(filePath)\r\n}\r\n\r\n/**\r\n * Compares two arrays of arrays (AOA) and identifies differences based on a custom comparator function.\r\n * @param actualAOA - The actual array of arrays.\r\n * @param expectedAOA - The expected array of arrays for comparison.\r\n * @param comparator - A function to compare individual elements in the arrays (default is a simple !== comparison).\r\n * @returns An instance of DiffAOA<T> representing the differences between the two arrays of arrays.\r\n * @template T - The type of data in the arrays of arrays.\r\n */\r\nexport function diff<T>(\r\n actualAOA: T[][],\r\n expectedAOA: T[][],\r\n comparator: (actual: T, expected: T) => boolean = (actual, expected) => actual !== expected\r\n): DiffAOA<T> {\r\n const diffAOA: DiffAOA<T> = new DiffAOA();\r\n const maxRowCount = Math.max(actualAOA.length, expectedAOA.length);\r\n\r\n for (let i = 0; i < maxRowCount; i += 1) {\r\n const diffRow: (T | (T | null)[])[] = [];\r\n const maxColCount = Math.max(actualAOA?.[i]?.length || 0, expectedAOA?.[i]?.length || 0);\r\n\r\n for (let j = 0; j < maxColCount; j += 1) {\r\n if (comparator(actualAOA?.[i]?.[j], expectedAOA?.[i]?.[j])) {\r\n diffAOA.diffCount += 1;\r\n diffRow[j] = [actualAOA?.[i]?.[j], expectedAOA?.[i]?.[j]];\r\n } else {\r\n diffRow[j] = expectedAOA?.[i]?.[j];\r\n }\r\n }\r\n\r\n diffAOA.push(diffRow);\r\n }\r\n return diffAOA;\r\n}\r\n\r\n/**\r\n * Calculates the difference between two workbooks.\r\n * @template T - The type of the elements in the workbooks.\r\n * @param actualWorkBook - The actual workbook.\r\n * @param expectedWorkBook - The expected workbook.\r\n * @param comparator - The comparator function to compare elements in the workbooks. Defaults to a function that checks for inequality.\r\n * @param sheetPatcher - The function to generate a patched string for sheet names. Defaults to a function that generates a string with added and removed sheet names.\r\n * @returns - The diff workbook containing the differences between the two workbooks.\r\n */\r\nexport function diffWorkBook<T>(\r\n actualWorkBook: WorkBook,\r\n expectedWorkBook: WorkBook,\r\n comparator: (actual: T, expected: T) => boolean = (actual, expected) => actual !== expected,\r\n sheetPatcher = (actual: string | null, expected: string | null) => {\r\n let patchedString = \"\"\r\n if (actual)\r\n patchedString += `(-)(${actual})`\r\n if (expected)\r\n patchedString += `(+)(${expected})`\r\n return patchedString\r\n }\r\n) {\r\n const diffWorkBook: DiffWorkBook<T> = new DiffWorkBook()\r\n const actualSheets = actualWorkBook.SheetNames\r\n const expectedSheets = expectedWorkBook.SheetNames\r\n const maxSheetCount = Math.max(actualSheets?.length || 0, expectedSheets?.length || 0)\r\n for (let i = 0; i < maxSheetCount; i += 1) {\r\n if (comparator(actualSheets?.[i] as T, expectedSheets?.[i] as T)) {\r\n const actualPatchedSheet = sheetPatcher(actualSheets?.[i],null)\r\n diffWorkBook.sheets[actualPatchedSheet] = diff<T>(\r\n utils.sheet_to_json(actualWorkBook.Sheets[actualSheets?.[i]], { header: 1 }),\r\n [],\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[actualPatchedSheet].diffCount\r\n const expectedPatchedSheet = sheetPatcher(null,expectedSheets?.[i])\r\n diffWorkBook.sheets[expectedPatchedSheet] = diff<T>(\r\n [],\r\n utils.sheet_to_json(expectedWorkBook.Sheets[expectedSheets?.[i]], { header: 1 }),\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[expectedPatchedSheet].diffCount\r\n }\r\n else {\r\n diffWorkBook.sheets[expectedSheets[i]] = diff<T>(\r\n utils.sheet_to_json(actualWorkBook.Sheets[actualSheets?.[i]], { header: 1 }),\r\n utils.sheet_to_json(expectedWorkBook.Sheets[expectedSheets?.[i]], { header: 1 }),\r\n comparator\r\n )\r\n diffWorkBook.diffCount += diffWorkBook.sheets[expectedSheets[i]].diffCount\r\n }\r\n }\r\n return diffWorkBook\r\n}","import Formatter from \"./formatter\";\r\n\r\n/**\r\n * Represents the differences between two arrays of arrays (AOA) with a customizable format.\r\n * @template T - The type of data in the arrays of arrays.\r\n */\r\nclass DiffAOA<T> extends Array<Array<T | Array<T | null>>> {\r\n #diffCount: number = 0;\r\n\r\n /**\r\n * Formats the differences using the provided formatter.\r\n * @param formatter - The formatter object responsible for generating the formatted string.\r\n * @returns The formatted string representing the differences.\r\n */\r\n format(formatter: Formatter<T>): string {\r\n return formatter.format(this as DiffAOA<T>);\r\n }\r\n\r\n /**\r\n * Gets the count of differences in the array of arrays.\r\n * @returns The number of differences.\r\n */\r\n get diffCount() {\r\n return this.#diffCount;\r\n }\r\n\r\n /**\r\n * Sets the count of differences in the array of arrays.\r\n * @param value - The number of differences to set.\r\n */\r\n set diffCount(value: number) {\r\n this.#diffCount = value;\r\n }\r\n}\r\n\r\nexport default DiffAOA;","import DiffAOA from \"./DiffAOA\";\r\nimport { WorkbookFormatter } from \"./formatter/workbook\";\r\n/**\r\n * Represents a workbook that stores the differences between two workbooks.\r\n * @template T - The type of data stored in the workbook.\r\n */\r\nclass DiffWorkBook<T> {\r\n sheets: { [sheet: string]: DiffAOA<T>; };\r\n #diffCount: number = 0;\r\n\r\n constructor() {\r\n this.sheets = {};\r\n }\r\n\r\n /**\r\n * Formats the workbook using the specified formatter.\r\n * @param formatter - The formatter to use for formatting the workbook.\r\n * @returns The formatted workbook.\r\n */\r\n format(formatter: WorkbookFormatter<T>) {\r\n return formatter.format(this.sheets);\r\n }\r\n\r\n /**\r\n * Gets the number of differences in the workbook.\r\n */\r\n get diffCount() {\r\n return this.#diffCount;\r\n }\r\n\r\n /**\r\n * Sets the number of differences in the workbook.\r\n */\r\n set diffCount(value: number) {\r\n this.#diffCount = value;\r\n }\r\n}\r\n\r\nexport default DiffWorkBook;"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,OAAO,QAAQ;;;ACDf;AAMA,IAAM,UAAN,cAAyB,MAAkC;AAAA,EAA3D;AAAA;AACI,mCAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrB,OAAO,WAAiC;AACpC,WAAO,UAAU,OAAO,IAAkB;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,YAAY;AACZ,WAAO,mBAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,UAAU,OAAe;AACzB,uBAAK,YAAa;AAAA,EACtB;AACJ;AA1BI;AA4BJ,IAAO,kBAAQ;;;ADhCf,OAAO,QAAkB,aAAa;;;AEHtC,IAAAA;AAMA,IAAM,eAAN,MAAsB;AA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AE,GAAG,EAAE,QAAQ,EAAE,CAAC;AAAA,QAC/E;AAAA,MACJ;AACA,MAAAA,cAAa,aAAaA,cAAa,OAAO,eAAe,CAAC,CAAC,EAAE;AAAA,IACrE;AAAA,EACJ;AACA,SAAOA;AACX;","names":["_diffCount","diffWorkBook"]} |
+3
-1
| { | ||
| "name": "spread-diff-patch", | ||
| "version": "1.1.4", | ||
| "version": "1.2.0", | ||
| "description": "Diff & patch SpreadSheet files", | ||
@@ -40,2 +40,3 @@ "main": "./lib/index.js", | ||
| "@types/papaparse": "^5.3.14", | ||
| "escape-html": "^1.0.3", | ||
| "papaparse": "^5.4.1", | ||
@@ -46,2 +47,3 @@ "xlsx": "^0.18.5" | ||
| "@jest/globals": "^29.7.0", | ||
| "@types/escape-html": "^1.0.4", | ||
| "@types/jest": "^29.5.12", | ||
@@ -48,0 +50,0 @@ "@typescript-eslint/eslint-plugin": "^7.0.2", |
| import { WorkBook } from 'xlsx'; | ||
| import Formatter from './formatter/index.mjs'; | ||
| /** | ||
| * Represents the differences between two arrays of arrays (AOA) with a customizable format. | ||
| * @template T - The type of data in the arrays of arrays. | ||
| */ | ||
| declare class DiffAOA<T> extends Array<Array<T | Array<T | null>>> { | ||
| #private; | ||
| /** | ||
| * Formats the differences using the provided formatter. | ||
| * @param formatter - The formatter object responsible for generating the formatted string. | ||
| * @returns The formatted string representing the differences. | ||
| */ | ||
| format(formatter: Formatter<T>): string; | ||
| /** | ||
| * Gets the count of differences in the array of arrays. | ||
| * @returns The number of differences. | ||
| */ | ||
| get diffCount(): number; | ||
| /** | ||
| * Sets the count of differences in the array of arrays. | ||
| * @param value - The number of differences to set. | ||
| */ | ||
| set diffCount(value: number); | ||
| } | ||
| /** | ||
| * Represents a formatter for a workbook. | ||
| * @template T - The type of data in the workbook. | ||
| */ | ||
| declare class WorkbookFormatter<T> { | ||
| patch: (actual: T | null, expected: T | null) => string; | ||
| /** | ||
| * Creates a new instance of WorkbookFormatter. | ||
| * @param patcher - A function that generates the patch string for a given actual and expected value. | ||
| */ | ||
| constructor(patcher?: (actual: T | null, expected: T | null) => string); | ||
| /** | ||
| * Formats the diff sheets of the workbook. | ||
| * @param diffSheets - An object representing the diff sheets. | ||
| * @returns The formatted workbook. | ||
| */ | ||
| format(diffSheets: { | ||
| [sheet: string]: DiffAOA<T>; | ||
| }): WorkBook; | ||
| } | ||
| export { DiffAOA as D, WorkbookFormatter as W }; |
| import { WorkBook } from 'xlsx'; | ||
| import Formatter from './formatter/index.js'; | ||
| /** | ||
| * Represents the differences between two arrays of arrays (AOA) with a customizable format. | ||
| * @template T - The type of data in the arrays of arrays. | ||
| */ | ||
| declare class DiffAOA<T> extends Array<Array<T | Array<T | null>>> { | ||
| #private; | ||
| /** | ||
| * Formats the differences using the provided formatter. | ||
| * @param formatter - The formatter object responsible for generating the formatted string. | ||
| * @returns The formatted string representing the differences. | ||
| */ | ||
| format(formatter: Formatter<T>): string; | ||
| /** | ||
| * Gets the count of differences in the array of arrays. | ||
| * @returns The number of differences. | ||
| */ | ||
| get diffCount(): number; | ||
| /** | ||
| * Sets the count of differences in the array of arrays. | ||
| * @param value - The number of differences to set. | ||
| */ | ||
| set diffCount(value: number); | ||
| } | ||
| /** | ||
| * Represents a formatter for a workbook. | ||
| * @template T - The type of data in the workbook. | ||
| */ | ||
| declare class WorkbookFormatter<T> { | ||
| patch: (actual: T | null, expected: T | null) => string; | ||
| /** | ||
| * Creates a new instance of WorkbookFormatter. | ||
| * @param patcher - A function that generates the patch string for a given actual and expected value. | ||
| */ | ||
| constructor(patcher?: (actual: T | null, expected: T | null) => string); | ||
| /** | ||
| * Formats the diff sheets of the workbook. | ||
| * @param diffSheets - An object representing the diff sheets. | ||
| * @returns The formatted workbook. | ||
| */ | ||
| format(diffSheets: { | ||
| [sheet: string]: DiffAOA<T>; | ||
| }): WorkBook; | ||
| } | ||
| export { DiffAOA as D, WorkbookFormatter as W }; |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
103100
13.16%47
14.63%1139
12.66%4
33.33%12
9.09%5
150%+ Added
+ Added