Skip to content

Commit

Permalink
docs(front_matter): complete documentation (#4166)
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua committed Jan 11, 2024
1 parent 7cb9b20 commit eb214d4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions front_matter/create_extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ import {

type Format = "yaml" | "toml" | "json" | "unknown";

/** Return type for {@linkcode Extractor}. */
export type Extract<T> = {
frontMatter: string;
body: string;
attrs: T;
};

/** Function return type for {@linkcode createExtractor}. */
export type Extractor = <T = Record<string, unknown>>(
str: string,
) => Extract<T>;

/** Parser function type used alongside {@linkcode createExtractor}. */
export type Parser = <T = Record<string, unknown>>(str: string) => T;

function _extract<T>(
Expand Down

0 comments on commit eb214d4

Please sign in to comment.