@std/front-matter@0.215.0
latest
Works with
•JSR Score64%•It is unknown whether this package works with Node.js, Deno, Browsers, Cloudflare Workers, Bun




Published2 years ago (0.215.0)
default
Extracts front matter from strings.
Functions
f
createExtractor(formats: Partial<Record<"yaml" | "toml" | "json" | "unknown", Parser>>): Extractor
Factory that creates a function that extracts front matter from a string with the given parsers. Supports YAML, TOML and JSON.
f
test(): boolean
str: string,
formats?: ("yaml" | "toml" | "json" | "unknown")[]
Tests if a string has valid front matter. Supports YAML, TOML and JSON.
Type Aliases
T
Extract<T> = { frontMatter: string; body: string; attrs: T; }
Return type for Extractor.
- attrs: TNo documentation available
- body: stringNo documentation available
- frontMatter: stringNo documentation available
T
Extractor = <T = Record<string, unknown>>(str: string) => Extract<T>
Function return type for createExtractor.
T
Parser = <T = Record<string, unknown>>(str: string) => T
Parser function type used alongside createExtractor.
create_extractor
Functions
f
createExtractor(formats: Partial<Record<"yaml" | "toml" | "json" | "unknown", Parser>>): Extractor
Factory that creates a function that extracts front matter from a string with the given parsers. Supports YAML, TOML and JSON.
Type Aliases
T
Extract<T> = { frontMatter: string; body: string; attrs: T; }
Return type for Extractor.
- attrs: TNo documentation available
- body: stringNo documentation available
- frontMatter: stringNo documentation available
T
Extractor = <T = Record<string, unknown>>(str: string) => Extract<T>
Function return type for createExtractor.
T
Parser = <T = Record<string, unknown>>(str: string) => T
Parser function type used alongside createExtractor.