I tried to write a really funny joke about a dedent, but it just didn’t indent well 🥁 While my sense of humour is beyond fixing, extra identation can easily be stripped with dedent.
Let's install it e.g. with deno add npm:dedent
, create a file, e.g. main.ts
and try out:
import d from 'dedent'
console.log(d`
What do you call a Christmas tree that’s lost its way?
...A mistletoe!
`)
Run with e.g. deno run -A ./main.ts
and enjoy perfectly aligned lines:
deno run -A ./main.ts
#What do you call a Christmas tree that’s lost its way?
# ...A mistletoe!
Extra padding? Gone.
Bad taste and formatting: preserved👌
Any ideas what dedent
could help you with? Share in the comments!
Liked the content and would love to have more of it all year long?
Top comments (0)