- (feat) add concept of post processors
- (feat) add 'key as default value' post processor (closes #109) - (chore) move clean functionality to a post processor - (chore) move sort functionality to a post processor - (refactor) get rid of leading underscore on protected properties/methods
This commit is contained in:
@@ -41,6 +41,14 @@ export class TranslationCollection {
|
||||
return new TranslationCollection(values);
|
||||
}
|
||||
|
||||
public map(callback: (key?: string, val?: string) => string): TranslationCollection {
|
||||
let values: TranslationType = {};
|
||||
this.forEach((key: string, val: string) => {
|
||||
values[key] = callback.call(this, key, val);
|
||||
});
|
||||
return new TranslationCollection(values);
|
||||
}
|
||||
|
||||
public union(collection: TranslationCollection): TranslationCollection {
|
||||
return new TranslationCollection({ ...this.values, ...collection.values });
|
||||
}
|
||||
|
Reference in New Issue
Block a user