@wave-server/wave_response_code
v1.0.2
Published
wave custom api response codes and messages in multiple langauges
Downloads
7
Readme
Wave Error Reponse Codes and Messages in Locale
types & interfaces
type Locales = 'ko' | 'en';
type IResponse = {
[code : number]: string;
}
methods
// Returns error message by locale and code
function getMessage(locale: Locales, code: number): string
// Returns whole json by locale
function getJSONByLocale(locale: Locales): IResponse
build & test
npm run build
/// compares every json lengths, same keys, nullable values
examples
import {getMessage, getJSONByLocale} from '@wave-server/wave_response_code';
const message = getMessage('ko', 1000);
console.log(message) // 친구를 찾을 수 없습니다
const json = getJSONByLocale('ko');
console.log(json) // {"1000": "친구를 찾을 수 없습니다", "2000": "친구를 추가할 수 없습니다"}