INNER CODE UNIT · TypeScript

assertIsKey

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

export function assertIsKey(key: unknown): asserts key is string {
  if (typeof key !== 'string') {
    throw new Error('@vercel/global-config: Expected key to be a string');
  }
}

export function isEmptyKey(key: string): boolean {
  return key.trim() === '';
}

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',
    );
  }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…