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

proposal(front_matter): fix file names and exports #4398

Open
timreichen opened this issue Feb 26, 2024 · 5 comments
Open

proposal(front_matter): fix file names and exports #4398

timreichen opened this issue Feb 26, 2024 · 5 comments
Labels
feedback welcome We want community's feedback on this issue or PR

Comments

@timreichen
Copy link
Contributor

Is your feature request related to a problem? Please describe.

front_matters any.ts file does not export any() but extract(). Also, json.ts, toml.ts and yaml.ts all export a function called extract(). mod.ts on the other hand doesn't re-export any of these.

Describe the solution you'd like

I propose to do the following changes to have them behave more like other std implementations:

  • rename any.ts to extract.ts
  • rename json.ts to extract_json.ts and extract() to extractJson()
  • rename toml.ts to extract_toml.ts and extract() to extractToml()
  • rename yaml.ts to extract_yaml.ts and extract() to extractYaml()

Describe alternatives you've considered

Leave as is.

@iuioiua
Copy link
Collaborator

iuioiua commented Mar 3, 2024

+1

@iuioiua iuioiua added the feedback welcome We want community's feedback on this issue or PR label Mar 3, 2024
@timreichen
Copy link
Contributor Author

@iuioiua I wonder now, if parse*() would make more sense, because the frontmatter data is not just extracted but parsed as well.

@iuioiua
Copy link
Collaborator

iuioiua commented Mar 6, 2024

Yeah, maybe. Other opinions are welcome.

@gabelluardo
Copy link
Contributor

+1 for parse I think it's more correct and intuitive

@iuioiua
Copy link
Collaborator

iuioiua commented Mar 18, 2024

I've thought about this further, and parse() might be as equally misleading as extract(), as the function extracts and then parses the front matter metadata. So perhaps the function names should be something like extractAndParseJson(), etc. I'm happy to hear other opinions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback welcome We want community's feedback on this issue or PR
Projects
None yet
Development

No branches or pull requests

3 participants