Home / Function/ containsStringIgnoringLeadingWhitespace() — supabase Function Reference

containsStringIgnoringLeadingWhitespace() — supabase Function Reference

Architecture documentation for the containsStringIgnoringLeadingWhitespace() function in CodeSample.test.ts from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/docs/features/directives/CodeSample.test.ts lines 30–56

export function containsStringIgnoringLeadingWhitespace(str1: string, str2: string): boolean {
  const lines1 = str1.split('\n').map((line) => line.trimStart())
  const lines2 = str2.split('\n').map((line) => line.trimStart())

  if (lines2.length === 0) {
    return true
  }

  if (lines2.length > lines1.length) {
    return false
  }

  for (let i = 0; i <= lines1.length - lines2.length; i++) {
    let matches = true
    for (let j = 0; j < lines2.length; j++) {
      if (lines1[i + j] !== lines2[j]) {
        matches = false
        break
      }
    }
    if (matches) {
      return true
    }
  }

  return false
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free