INNER CODE UNIT · TypeScript

isInstagramUser

mifi/instauto · src/index.ts:188

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) {
    const j = Math.floor(Math.random() * (i + 1));
    const temp = array[i];
    if (temp === undefined || array[j] === undefined) {
      throw new Error('Invalid shuffle index');

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…