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

Add collectionStyle option #343

Merged
merged 1 commit into from
Dec 28, 2021
Merged

Add collectionStyle option #343

merged 1 commit into from
Dec 28, 2021

Conversation

eemeli
Copy link
Owner

@eemeli eemeli commented Dec 27, 2021

Add to ToString options:

type ToStringOptions = { ...
  /**
   * Enforce `'block'` or `'flow'` style on maps and sequences.
   * Empty collections will always be stringified as `{}` or `[]`.
   *
   * Default: `'any'`, allowing each node to set its style separately
   * with its `flow: boolean` (default `false`) property.
   */
  collectionStyle?: 'any' | 'block' | 'flow'
}

This should help in particular with the production of JSON-ish output, where block collections are not supported.

@eemeli eemeli merged commit 6e00711 into master Dec 28, 2021
@eemeli eemeli deleted the collection-style branch December 28, 2021 12:21
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