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

Return undefined on equal counts? #11

Closed
silverwind opened this issue Sep 19, 2023 · 2 comments · Fixed by #12
Closed

Return undefined on equal counts? #11

silverwind opened this issue Sep 19, 2023 · 2 comments · Fixed by #12

Comments

@silverwind
Copy link
Contributor

I noticed the module has a bias towards LF, e.g. when a string contains a equal amount of LF and CRLF, it will return LF. The module's description says it returns the "dominant" variant, but when they are equal, none dominate and I think it would be more correct to return undefined.

@silverwind silverwind changed the title Return undefined when equal counts? Return undefined on equal counts? Sep 19, 2023
@sindresorhus
Copy link
Owner

While you are techincally correct, I think the current behavior is more pragmatic. It would also be too much of a breaking change to change it at this point. It would be better to update the docs to reflect the behavior.

@silverwind
Copy link
Contributor Author

Documenting it only is fine with me.

silverwind added a commit to silverwind/detect-newline that referenced this issue Sep 21, 2023
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 a pull request may close this issue.

2 participants