(refactor) use object spread syntax

This commit is contained in:
Kim Biesbjerg 2019-06-11 12:54:50 +02:00
parent d07d81681e
commit 590f58fff3
2 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ export class ExtractTask implements TaskInterface {
protected _compiler: CompilerInterface;
public constructor(protected _input: string[], protected _output: string[], options?: ExtractTaskOptionsInterface) {
this._options = Object.assign({}, this._options, options);
this._options = { ...this._options, ...options };
}
public execute(): void {

View File

@ -11,7 +11,7 @@ export class TranslationCollection {
}
public add(key: string, val: string = ''): TranslationCollection {
return new TranslationCollection(Object.assign({}, this.values, { [key]: val }));
return new TranslationCollection({ ...this.values, [key]: val });
}
public addKeys(keys: string[]): TranslationCollection {
@ -19,7 +19,7 @@ export class TranslationCollection {
results[key] = '';
return results;
}, <TranslationType> {});
return new TranslationCollection(Object.assign({}, this.values, values));
return new TranslationCollection({ ...this.values, ...values });
}
public remove(key: string): TranslationCollection {
@ -42,7 +42,7 @@ export class TranslationCollection {
}
public union(collection: TranslationCollection): TranslationCollection {
return new TranslationCollection(Object.assign({}, this.values, collection.values));
return new TranslationCollection({ ...this.values, ...collection.values });
}
public intersect(collection: TranslationCollection): TranslationCollection {