Skip to content

Commit ac59a6a

Browse files
authored
refactor: simplify scope cases (#94)
1 parent 655020a commit ac59a6a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/i18n.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,14 @@ export function useI18n<
371371

372372
const global = i18n.global
373373

374-
let emptyOption = false
375374
// prettier-ignore
376-
const scope: I18nScope = (emptyOption = isEmptyObject(options)) // eslint-disable-line no-cond-assign
375+
const scope: I18nScope = isEmptyObject(options)
377376
? 'global'
378377
: !options.useScope
379378
? 'local'
380379
: options.useScope
381380

382-
if (emptyOption) {
381+
if (scope === 'global') {
383382
return global
384383
}
385384

@@ -398,8 +397,6 @@ export function useI18n<
398397
composer = global
399398
}
400399
return composer
401-
} else if (scope === 'global') {
402-
return global
403400
}
404401

405402
// scope 'local' case

0 commit comments

Comments
 (0)