(refactor) rename working to draft

This commit is contained in:
Kim Biesbjerg 2019-07-17 12:44:21 +02:00
parent ac551b1824
commit e41fc88d97
5 changed files with 12 additions and 12 deletions

View File

@ -63,7 +63,7 @@ export class ExtractTask implements TaskInterface {
} }
// merge extracted strings with existing // merge extracted strings with existing
const working = extracted.union(existing); const draft = extracted.union(existing);
if (existing.isEmpty()) { if (existing.isEmpty()) {
this.out(dim(`- ${outputPath}`)); this.out(dim(`- ${outputPath}`));
@ -72,7 +72,7 @@ export class ExtractTask implements TaskInterface {
} }
// Run collection through post processors // Run collection through post processors
const final = this.process(working, extracted, existing); const final = this.process(draft, extracted, existing);
// Save to file // Save to file
this.save(outputPath, final); this.save(outputPath, final);
@ -116,11 +116,11 @@ export class ExtractTask implements TaskInterface {
/** /**
* Run strings through configured post processors * Run strings through configured post processors
*/ */
protected process(working: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection { protected process(draft: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
this.postProcessors.forEach(postProcessor => { this.postProcessors.forEach(postProcessor => {
working = postProcessor.process(working, extracted, existing); draft = postProcessor.process(draft, extracted, existing);
}); });
return working; return draft;
} }
/** /**

View File

@ -5,8 +5,8 @@ export class KeyAsDefaultValuePostProcessor implements PostProcessorInterface {
public name: string = 'KeyAsDefaultValue'; public name: string = 'KeyAsDefaultValue';
public process(working: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection { public process(draft: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
return working.map((key, val) => val === '' ? key : val); return draft.map((key, val) => val === '' ? key : val);
} }
} }

View File

@ -4,6 +4,6 @@ export interface PostProcessorInterface {
name: string; name: string;
process(working: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection; process(draft: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection;
} }

View File

@ -5,8 +5,8 @@ export class PurgeObsoleteKeysPostProcessor implements PostProcessorInterface {
public name: string = 'PurgeObsoleteKeys'; public name: string = 'PurgeObsoleteKeys';
public process(working: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection { public process(draft: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
return working.intersect(extracted); return draft.intersect(extracted);
} }
} }

View File

@ -5,8 +5,8 @@ export class SortByKeyPostProcessor implements PostProcessorInterface {
public name: string = 'SortByKey'; public name: string = 'SortByKey';
public process(working: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection { public process(draft: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
return working.sort(); return draft.sort();
} }
} }