INNER CODE UNIT · TypeScript

clone

vercel/storage · packages/global-config/src/utils/index.ts:58

  function clone<T>(value: T): T {
    // only available since node v17.0.0
    if (typeof structuredClone === 'function') return structuredClone<T>(value);

    // poor man's polyfill for structuredClone
    if (value === undefined) return value;
    return JSON.parse(JSON.stringify(value)) as T;
  },
  { name: 'clone' },
);

/**
 * Parses internal global config connection strings
 *
 * Internal global config connection strings are those which are native to Vercel.
 *
 * Internal Global Config Connection Strings look like this:
 * - https://global-config.vercel.com/<globalConfigId>?token=<token>

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…