-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opts: parseKeyValueFile: cleanup and remove redundant trimming
- the function already trimmed leading whitespace from each line before parsing. keys with trailing whitespace would be invalidated, and values have whitespace preserved, so there's no need to trim whitespace for the key. - if a line is validated (key is valid), we don't need to reconstruct the key=value by concatenating, and we can add the line as-is. - check if the key is empty before checking if it contains whitespace - touch-up comments - rename some variables for readability - slight cleanup to use early returns / early continues to reduce nesting Signed-off-by: Sebastiaan van Stijn <[email protected]>
- Loading branch information
Showing
1 changed file
with
33 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters