Skip to content

Commit

Permalink
getLinesWithFilters should not mutate the config given as argument
Browse files Browse the repository at this point in the history
  • Loading branch information
remusao committed Jun 14, 2019
1 parent 218d5b7 commit eba8190
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export function getLinesWithFilters(
raw: string,
config: Partial<Config> = new Config(),
): Set<string> {
config = new Config(Object.assign(config, { debug: true }));
config = new Config(Object.assign({}, config, { debug: true }));

const {
networkFilters,
Expand All @@ -210,9 +210,13 @@ export function getLinesWithFilters(
* Given two versions of the same subscription (e.g.: EasyList) as a string,
* generate a raw diff (i.e.: a list of lines added and lines removed).
*/
export function generateDiff(prevRevision: string, newRevision: string): IRawDiff {
const prevRevisionLines: Set<string> = getLinesWithFilters(prevRevision);
const newRevisionLines: Set<string> = getLinesWithFilters(newRevision);
export function generateDiff(
prevRevision: string,
newRevision: string,
config: Partial<Config> = new Config(),
): IRawDiff {
const prevRevisionLines: Set<string> = getLinesWithFilters(prevRevision, config);
const newRevisionLines: Set<string> = getLinesWithFilters(newRevision, config);

const added: string[] = [];
const removed: string[] = [];
Expand Down

0 comments on commit eba8190

Please sign in to comment.