Skip to content

Commit

Permalink
fix: Fix regression with --null-as-default-value
Browse files Browse the repository at this point in the history
Fixes #18
  • Loading branch information
SamanthaAdrichem committed Aug 10, 2023
1 parent 1a4cc60 commit 58bb22a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/post-processors/null-as-default-value.post-processor.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { TranslationCollection } from '../utils/translation.collection.js';
import {TranslationCollection, TranslationInterface} from '../utils/translation.collection.js';
import { PostProcessorInterface } from './post-processor.interface.js';

export class NullAsDefaultValuePostProcessor implements PostProcessorInterface {
public name: string = 'NullAsDefaultValue';

public process(draft: TranslationCollection, extracted: TranslationCollection, existing: TranslationCollection): TranslationCollection {
return draft.map((key, val) => (existing.get(key) === undefined ? null : val));
return draft.map((key, val) => (existing.get(key) === undefined ? <TranslationInterface>{value: null, sourceFiles: []} : val));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('NullAsDefaultValuePostProcessor', () => {
const extracted = new TranslationCollection({ 'String A': {value: '', sourceFiles: []} });
const existing = new TranslationCollection();
expect(processor.process(draft, extracted, existing).values).to.deep.equal({
'String A': null
'String A': {value: null, sourceFiles: []}
});
});

Expand Down

0 comments on commit 58bb22a

Please sign in to comment.