Home / Function/ getYAMLErrorLine() — astro Function Reference

getYAMLErrorLine() — astro Function Reference

Architecture documentation for the getYAMLErrorLine() function in utils.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  a0205099_ee90_216f_374a_b6b4ab0e709c["getYAMLErrorLine()"]
  7a09e708_c090_71c0_8138_7343699b1865["utils.ts"]
  a0205099_ee90_216f_374a_b6b4ab0e709c -->|defined in| 7a09e708_c090_71c0_8138_7343699b1865
  491817d6_81a3_cf47_fbd9_bfd8550b7529["getEntryData()"]
  491817d6_81a3_cf47_fbd9_bfd8550b7529 -->|calls| a0205099_ee90_216f_374a_b6b4ab0e709c
  cd84d6e1_92d2_4736_d9f7_adb765de0289["search()"]
  a0205099_ee90_216f_374a_b6b4ab0e709c -->|calls| cd84d6e1_92d2_4736_d9f7_adb765de0289
  style a0205099_ee90_216f_374a_b6b4ab0e709c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/utils.ts lines 433–445

function getYAMLErrorLine(rawData: string | undefined, objectKey: string) {
	if (!rawData) return 0;
	const indexOfObjectKey = rawData.search(
		// Match key either at the top of the file or after a newline
		// Ensures matching on top-level object keys only
		new RegExp(`(\n|^)${objectKey}`),
	);
	if (indexOfObjectKey === -1) return 0;

	const dataBeforeKey = rawData.substring(0, indexOfObjectKey + 1);
	const numNewlinesBeforeKey = dataBeforeKey.split('\n').length;
	return numNewlinesBeforeKey;
}

Subdomains

Calls

Called By

Frequently Asked Questions

What does getYAMLErrorLine() do?
getYAMLErrorLine() is a function in the astro codebase, defined in packages/astro/src/content/utils.ts.
Where is getYAMLErrorLine() defined?
getYAMLErrorLine() is defined in packages/astro/src/content/utils.ts at line 433.
What does getYAMLErrorLine() call?
getYAMLErrorLine() calls 1 function(s): search.
What calls getYAMLErrorLine()?
getYAMLErrorLine() is called by 1 function(s): getEntryData.

Analyze Your Own Codebase

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

Try Supermodel Free