MCPcopy Index your code
hub / github.com/linuxfoundation/crowd.dev / format

Function format

frontend/src/i18n/index.js:78–94  ·  view source on GitHub ↗
(message, args)

Source from the content-addressed store, hash-verified

76}
77
78function format(message, args) {
79 if (!message) {
80 return null;
81 }
82
83 try {
84 return message.replace(
85 /{(\d+)}/g,
86 (match, number) => (typeof args[number] !== 'undefined'
87 ? args[number]
88 : match),
89 );
90 } catch (error) {
91 console.error(message, error);
92 throw error;
93 }
94}
95
96export function getLanguages() {
97 return Object.keys(languages).map((language) => languages[language]);

Callers 1

i18nFunction · 0.70

Calls 1

errorMethod · 0.45

Tested by

no test coverage detected