Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: YAML parser #339

Merged
merged 1 commit into from
Aug 21, 2024
Merged

feat: YAML parser #339

merged 1 commit into from
Aug 21, 2024

Conversation

magne4000
Copy link
Member

@magne4000 magne4000 commented Aug 21, 2024

New loadYaml util to parse existing YAML documents. This function uses yaml, and returns a Document.

Usage example

import { loadYaml, type TransformerProps } from "@batijs/core";

export default async function getYaml(props: TransformerProps) {
  const document = await loadYaml(props);

  // Add a node to the document
  document.add(document.createNode({ something: true }));

  // You can return the document directly
  return document;
  // Or if you want to customize `toString` options
  return document.toString({ ... });
}

@magne4000 magne4000 merged commit fe5a2ec into main Aug 21, 2024
7 of 8 checks passed
@magne4000 magne4000 deleted the yaml-parser branch August 21, 2024 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant