UNPKG

yaml-unist-parser

Version:

A YAML parser that produces output compatible with unist

28 lines (27 loc) 732 B
//#region src/cst.ts /** * Generator to iterate over tokens, skipping space and newline tokens. */ function* tokens(...tokensArgs) { for (const tokens$1 of tokensArgs) { if (!tokens$1) continue; for (const token of tokens$1) { if (isSpace(token)) continue; yield token; } } } /** * Type guard to check if a token is a space or newline token. */ function isSpace(token) { return token.type === "space" || token.type === "newline"; } /** * Type guard to check if a token is a content property token (comment, tag, or anchor). */ function maybeContentPropertyToken(token) { return token.type === "comment" || token.type === "tag" || token.type === "anchor"; } //#endregion export { maybeContentPropertyToken, tokens };