• Stars
    star
    157
  • Rank 236,962 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

TypeScript package which smartly trims and strips indentation from multi-line strings

TypeScript Dedent

codecov

TypeScript package which smartly trims and strips indentation from multi-line strings.

Usage Examples

import { dedent } from 'ts-dedent';

console.log(dedent`A string that gets so long you need to break it over
                    multiple lines. Luckily dedent is here to keep it
                    readable without lots of spaces ending up in the string
                    itself.`);

console.log(dedent`
  A string that gets so long you need to break it over
  multiple lines. Luckily dedent is here to keep it
  readable without lots of spaces ending up in the string
  itself.
`);
A string that gets so long you need to break it over
multiple lines. Luckily dedent is here to keep it
readable without lots of spaces ending up in the string
itself.

console.log(dedent`
  Leading and trailing lines will be trimmed, so you can write something like
  this and have it work as you expect:

    * how convenient it is
    * that I can use an indented list
        - and still have it do the right thing

  That's all.
`);
Leading and trailing lines will be trimmed, so you can write something like
this and have it work as you expect:

  * how convenient it is
  * that I can use an indented list
    - and still have it do the right thing

That's all.

console.log(dedent`
  Also works fine

  ${1}. With any kind of
  ${2}. Placeholders
`);
Also works fine

1. With any kind of
2. Placeholders

console.log(dedent(`
  Wait! I lied. Dedent can also be used as a function.
`);
Wait! I lied. Dedent can also be used as a function.

License

MIT

Based on

Changelog

See history for more details.

  • 2.2.1 2021-08-01 Update build dependencies and fixed typos in readme
  • 2.2.0 2021-08-01 Add indentation to values with multiline strings & added ESM module
  • 2.1.1 2021-03-31 Update build dependencies
  • 2.1.0 2021-03-24 Bugfixes
  • 2.0.0 2020-09-28 Bugfixes
  • 1.2.0 2020-09-28 Update build dependencies and a couple of minor improvments
  • 1.1.0 2019-07-26 Update build dependencies and fixed links in readme
  • 1.0.0 2018-06-14 Initial release

More Repositories

1

ui-snippets-menu-animations

Four different menu animations for menu button toggle between hamburger, cross and back icon.
CSS
170
star
2

contributions.taminomartinius.de

Website to display a bunch of different commit statistics fetched by GitHub GraphQL API
TypeScript
145
star
3

meteor-smart-record

Rails like models using ES6.
JavaScript
30
star
4

tamino.dev

My personal website =)
TypeScript
28
star
5

lambda-get-all-github-contributions

Fetch all GitHub Contributions and save them to a json on S3.
TypeScript
15
star
6

ui-snippets-checkboxes

HTML
13
star
7

node-github-graphql-api

A node client for the GitHub GraphQL API with minimal dependencies created with TypeScript.
TypeScript
8
star
8

meteor-method-pagination

CoffeeScript
6
star
9

node-next-model

Rails like models using ES6.
TypeScript
4
star
10

meteor-ics

iCalendar .ics export
JavaScript
4
star
11

atom-language-spacebars

Spacebars language from Meteor.js
4
star
12

template-webpack-typescript-vue

Webpack Template for TypeScript & VueJs
JavaScript
4
star
13

ui-snippets-radiobuttons

HTML
3
star
14

ui-snippets-ascii-generator

Create ASCII Art from any Image and play around with the different settings
TypeScript
3
star
15

cdk-lambda-layers--node-aws-sdk

AWS CDK Lambda Layer for Node.js with newer version of aws-sdk package
TypeScript
2
star
16

meteor-lazy-analytics

CoffeeScript
2
star
17

meteor-ui-underscore

Port of some underscore-js functions for ui.
HTML
2
star
18

meteor-handlebars-underscore

HTML
2
star
19

lets-talk-about--template

Template for slides build with HTML and CSS.
Stylus
2
star
20

lets-talk-about--graphql

Lets talk about ... GraphQL
Pug
2
star
21

node-pg-model

TypeScript
1
star
22

node-next-model-knex-connector

SQL connector for next-model package using Knex.
TypeScript
1
star
23

ui-snippets-template

Webpack Template with HTML (just body), CSS/PostCSS and JS/TypeScript
JavaScript
1
star
24

www.getshar.es

HTML
1
star
25

node-postgres-migrator

TypeScript
1
star
26

lets-talk-about--new-js-features--2020

Pug
1
star
27

api.getshar.es

CoffeeScript
1
star
28

lets-talk-about--typescript

Lets talk about ... TypeScript
Pug
1
star
29

lets-talk-about--example

Example for slides build with HTML and CSS.
Pug
1
star