(refactor) use object spread syntax
This commit is contained in:
parent
d07d81681e
commit
590f58fff3
@ -31,7 +31,7 @@ export class ExtractTask implements TaskInterface {
|
|||||||
protected _compiler: CompilerInterface;
|
protected _compiler: CompilerInterface;
|
||||||
|
|
||||||
public constructor(protected _input: string[], protected _output: string[], options?: ExtractTaskOptionsInterface) {
|
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 {
|
public execute(): void {
|
||||||
|
@ -11,7 +11,7 @@ export class TranslationCollection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public add(key: string, val: string = ''): 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 {
|
public addKeys(keys: string[]): TranslationCollection {
|
||||||
@ -19,7 +19,7 @@ export class TranslationCollection {
|
|||||||
results[key] = '';
|
results[key] = '';
|
||||||
return results;
|
return results;
|
||||||
}, <TranslationType> {});
|
}, <TranslationType> {});
|
||||||
return new TranslationCollection(Object.assign({}, this.values, values));
|
return new TranslationCollection({ ...this.values, ...values });
|
||||||
}
|
}
|
||||||
|
|
||||||
public remove(key: string): TranslationCollection {
|
public remove(key: string): TranslationCollection {
|
||||||
@ -42,7 +42,7 @@ export class TranslationCollection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public union(collection: TranslationCollection): 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 {
|
public intersect(collection: TranslationCollection): TranslationCollection {
|
||||||
|
Loading…
Reference in New Issue
Block a user