Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
22 lines
622 B
Plaintext
22 lines
622 B
Plaintext
import { cache } from 'react';
|
|
import getConfig from './getConfig.js';
|
|
import getFormatterCached$1 from './getServerFormatter.js';
|
|
|
|
async function getFormatterCachedImpl(locale) {
|
|
const config = await getConfig(locale);
|
|
return getFormatterCached$1(config);
|
|
}
|
|
const getFormatterCached = cache(getFormatterCachedImpl);
|
|
|
|
/**
|
|
* Returns a formatter based on the given locale.
|
|
*
|
|
* The formatter automatically receives the request config, but
|
|
* you can override it by passing in additional options.
|
|
*/
|
|
async function getFormatter(opts) {
|
|
return getFormatterCached(opts?.locale);
|
|
}
|
|
|
|
export { getFormatter as default };
|