Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiah-shaulov committed Oct 3, 2022
1 parent 9728fa6 commit d9e3f81
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type IndentAndWrapOptions =

This function does:
- Replaces new line characters (`\n`, `\r\n` or `\r`) to `options.endl`, or if it's not set to `\n`.
- Removes white space at the end of each line.
- If `options.indent` is set, it determines common indent characters across all lines, and replaces them with `options.indent` string.
This can lead to indent increase or decrease.
If `options.ignoreFirstIndent` is set, will look for common indent starting at second line, so the text can be trimmed.
Expand Down
16 changes: 16 additions & 0 deletions test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -859,5 +859,21 @@ Deno.test
),
'ab cd e\nf'
);

assertEquals
( indentAndWrap
( 'ab cd e \nf',
{wrapWidth: 8}
),
'ab cd e\nf'
);

assertEquals
( indentAndWrap
( '\tabcde',
{indent: '', tabsToSpaces: true}
),
'abcde'
);
}
);

0 comments on commit d9e3f81

Please sign in to comment.