Skip to content

Commit

Permalink
refactor: simplify the code
Browse files Browse the repository at this point in the history
  • Loading branch information
wewoor committed Sep 7, 2021
1 parent a83009b commit dc95957
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/i18n/__tests__/localeService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('The Locale Service', () => {

test('Get/Set current locale', () => {
const localeService = new LocaleService();
(localeService as any)._current = null;
(localeService as any)._current = undefined;
expect(localeService.getCurrentLocale()).toBeUndefined();
localeService.addLocales([TestLocale]);
localeService.setCurrentLocale(TestLocale.id);
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/localeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class LocaleService extends Component implements ILocaleService {
}

public getCurrentLocale(): ILocale | undefined {
return this._current ? Object.assign({}, this._current) : undefined;
return this._current && Object.assign({}, this._current);
}

public getLocale(id: string): ILocale | undefined {
Expand Down

0 comments on commit dc95957

Please sign in to comment.