HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
dmnd
dedent
TypeScript2023–2023
dmnd / dedent

dedent

⬅️ ES6 string tag that strips indentation from multi-line strings.

2Distinct people
2Mentions
0Explicit recommenders
1.2KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

⬅️ ES6 string tag that strips indentation from multi-line strings.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:03:16 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by hour2 dated mentions

Observed mentions: 2023-03-09 15:42:12 UTC to 2023-03-10 03:39:32 UTC.

012023-03-09 15:00:00 UTC to 2023-03-09 16:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsMar 9, 15:002023-03-09 16:00:00 UTC to 2023-03-09 17:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-03-09 17:00:00 UTC to 2023-03-09 18:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-03-09 18:00:00 UTC to 2023-03-09 19:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-03-09 19:00:00 UTC to 2023-03-09 20:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-03-09 20:00:00 UTC to 2023-03-09 21:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-03-09 21:00:00 UTC to 2023-03-09 22:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsMar 9, 21:002023-03-09 22:00:00 UTC to 2023-03-09 23:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-03-09 23:00:00 UTC to 2023-03-10 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-03-10 00:00:00 UTC to 2023-03-10 01:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-03-10 01:00:00 UTC to 2023-03-10 02:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-03-10 02:00:00 UTC to 2023-03-10 03:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-03-10 03:00:00 UTC to 2023-03-10 04:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsMar 10, 03:00

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Mar 9, 15:002023-03-09 15:00:00 UTC2023-03-09 16:00:00 UTC101
Mar 9, 16:002023-03-09 16:00:00 UTC2023-03-09 17:00:00 UTC000
Mar 9, 17:002023-03-09 17:00:00 UTC2023-03-09 18:00:00 UTC000
Mar 9, 18:002023-03-09 18:00:00 UTC2023-03-09 19:00:00 UTC000
Mar 9, 19:002023-03-09 19:00:00 UTC2023-03-09 20:00:00 UTC000
Mar 9, 20:002023-03-09 20:00:00 UTC2023-03-09 21:00:00 UTC000
Mar 9, 21:002023-03-09 21:00:00 UTC2023-03-09 22:00:00 UTC000
Mar 9, 22:002023-03-09 22:00:00 UTC2023-03-09 23:00:00 UTC000
Mar 9, 23:002023-03-09 23:00:00 UTC2023-03-10 00:00:00 UTC000
Mar 10, 00:002023-03-10 00:00:00 UTC2023-03-10 01:00:00 UTC000
Mar 10, 01:002023-03-10 01:00:00 UTC2023-03-10 02:00:00 UTC000
Mar 10, 02:002023-03-10 02:00:00 UTC2023-03-10 03:00:00 UTC000
Mar 10, 03:002023-03-10 03:00:00 UTC2023-03-10 04:00:00 UTC101

What Hacker News says

2 sources
It is actually important for a dedent function when the interpolands contain newlines. Consider this example: function fmt(q, a) { return dedent`\ Question: ${q} Answer: ${a} `; } Since `dedent` is basically syntactic sugar for developer convenience, we want this function to be equivalent to this: function fmtDesugared(q, a) { return `Question: ${q}\nAnswer: ${a}\n`; } Now consider this input: console.log(fmt("a\nb", "c\nd")); // should print: Question: a b Answer: c d But if `dedent` only got to see the string after interpolation—like this— function fmtWrong(q, a) { return dedent(`\ Question: ${q} Answer: ${a} `); } then the input to `dedent` would be Question: a b Answer: c d and so `dedent` would not st
Read the rest
rip any indentation. That is, `dedent` is meant to identify the maximal common leading indentation in the template as written by the developer, which should not depend on the values of the interpolands. A stale GitHub issue on the dmnd/dedent repo has a real-world example where this matters and led to a subtle bug: https://github.com/dmnd/dedent/issues/22
In JavaScript and TypeScript features of the last 3 years

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.