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

generator api ('joinToNode') supplements #1238

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

sailingKieler
Copy link
Contributor

Some improvements inspired by applications in productive projects

  • extended definition of 'JoinOptions' used to configure executions of 'joinToNode'
  • extended type definitions of joinToNode allowing to skip the toGenerated argument (conversion function)

…skip the `toGenerated` argument (conversion function)
@sailingKieler sailingKieler requested a review from msujew October 24, 2023 10:30
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks quite good, just a minor improvement, see below.

Comment on lines 106 to 107
const prefixFunc = typeof prefix === 'function' ? prefix : undefined;
const suffixFunc = typeof suffix === 'function' ? suffix : undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: All the undefined-checking and casting to Generated below is a bit ugly, we can just define the function here a bit smarter.

Suggested change
const prefixFunc = typeof prefix === 'function' ? prefix : undefined;
const suffixFunc = typeof suffix === 'function' ? suffix : undefined;
const prefixFunc = typeof prefix === 'function' ? prefix : (() => prefix);
const suffixFunc = typeof suffix === 'function' ? suffix : (() => suffix);

@sailingKieler sailingKieler force-pushed the cs-generator-api-supplement branch 2 times, most recently from 9e14108 to af9c170 Compare October 26, 2023 15:55
… executions of 'joinToNode'

* now allows specification of item prefixes and suffixes as fixed values, not only via provider functions
* now allows demanding to not append a newline after the last item of the given iterable, provided 'appendNewLineIfNotEmpty' is set
@sailingKieler sailingKieler force-pushed the cs-generator-api-supplement branch from af9c170 to dcb55f1 Compare October 26, 2023 16:11
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks 👍

@sailingKieler sailingKieler merged commit 018286d into main Nov 1, 2023
3 checks passed
@sailingKieler sailingKieler deleted the cs-generator-api-supplement branch November 1, 2023 15:04
@spoenemann spoenemann added this to the v2.1.0 milestone Jun 17, 2024
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.

3 participants