INNER CODE UNIT · TypeScript
assertIsKeys
vercel/storage · packages/global-config/src/utils/index.ts:46
export function assertIsKeys(keys: unknown): asserts keys is string[] {
if (!Array.isArray(keys) || keys.some((key) => typeof key !== 'string')) {
throw new Error(
'@vercel/global-config: Expected keys to be an array of string',
);
}
}
/**
* Creates a deep clone of an object.
*/
export const clone = trace(
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;