INNER CODE UNIT · TypeScript

isRecord

mifi/instauto · src/index.ts:184

function isRecord(value: unknown): value is Record<string, unknown> {
  return typeof value === 'object' && value !== null;
}

function isInstagramUser(value: unknown): value is InstagramUser {
  if (!isRecord(value)) return false;
  const { id, edge_followed_by: edgeFollowedBy, edge_follow: edgeFollow, is_private: isPrivate, is_verified: isVerified } = value;
  return typeof id === 'string'
    && isRecord(edgeFollowedBy)
    && isRecord(edgeFollow)
    && typeof isPrivate === 'boolean'
    && typeof isVerified === 'boolean';
}

// NOTE duplicated inside puppeteer page
function shuffleArray<T>(arrayIn: T[]): T[] {
  const array = [...arrayIn];
  for (let i = array.length - 1; i > 0; i -= 1) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…