Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatting할 때 자주 사용하는 패턴 #2

Open
hoo00nn opened this issue Sep 1, 2021 · 0 comments
Open

formatting할 때 자주 사용하는 패턴 #2

hoo00nn opened this issue Sep 1, 2021 · 0 comments
Assignees

Comments

@hoo00nn
Copy link
Contributor

hoo00nn commented Sep 1, 2021

사소한 거지만 개인적으로 자주 사용하는 패턴이라 기록해둠 😃

locale  -  'en', 'ja', 'ko' 
formatting된 결과물 - 'en_US', 'ja_JP', 'ko_KR'

export const formatLocale = (locale: 'en' | 'ja' | 'ko') => {
  const text = {
    en: 'en_US',
    ko: 'ko_KR',
    ja: 'ja_JP',
  }[locale];

  return text;
};
@hoo00nn hoo00nn self-assigned this Sep 1, 2021
@hoo00nn hoo00nn changed the title [사소한 기록] formatting할 때 자주 사용하는 패턴 formatting할 때 자주 사용하는 패턴 Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant