INNER CODE UNIT · TypeScript

cacheFetch

react/react-native-website · plugins/remark-lint-no-dead-urls/src/index.ts:41

async function cacheFetch(urlOrPath: string, method: Method, options: Options) {
  if (linkCache.has(urlOrPath)) {
    return [urlOrPath, linkCache.get(urlOrPath)];
  }

  const {baseUrl, ...other} = options;
  const url = new URL(urlOrPath, baseUrl).toString();

  const code = await fetch(url, method, other);

  linkCache.set(urlOrPath, code);
  return [urlOrPath, code];
}

async function naiveLinkCheck(urls: string[], options: Options) {
  return Promise.allSettled(
    urls.map(async url => {
      try {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…