-
Notifications
You must be signed in to change notification settings - Fork 663
Closed
Labels
Description
Describe the bug
text/unstable-dedent should only strip a single trailing newline, but instead it strips all trailing newlines.
Steps to Reproduce
import { assertEquals } from 'jsr:@std/assert';
import { dedent as stdDedent } from 'jsr:@std/text@1.0.16/unstable-dedent';
import npmDedent from 'npm:string-dedent@3.0.2';
for (const [name, dedent] of Object.entries({
'jsr:@std': stdDedent,
'npm:string-dedent': npmDedent,
})) {
Deno.test(name, async (t) => {
const v1 = dedent`
a
`;
// throws for jsr:@std, ok for npm:string-dedent
await t.step('v1', () => assertEquals(v1, 'a\n'));
const v2 = dedent`
a\n
`;
// throws for jsr:@std, ok for npm:string-dedent
await t.step('v2', () => assertEquals(v2, 'a\n'));
});
}Expected behavior
Only strip a single trailing newline.
Environment
text@1.0.16