
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
dedent-tabs
Advanced tools
It's basicly dedent, but with support for tabs and still maintained.
An ES6 string tag that strips indentation from multi-line strings.
import dedent from "dedent-tabs";
function usageExample() {
const first = 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.`;
const second = 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.
`;
const third = dedent(`
Wait! I lied. Dedent can also be used as a function.
`);
return first + "\n\n" + second + "\n\n" + third;
}
> console.log(usageExample());
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.
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.
Wait! I lied. Dedent can also be used as a function.
When using the template string tag syntax, for example:
dedent`
Hi there I am
a multi line
string
`
dedent
will not support all the escape sequences that a standard ES6 template string supports and will return them literally.
For example:
console.log(dedent`
\xA9
`)
// Logs "\xA9"
The currently supported escape sequences are:
The reason these escape characters are not fully supported is due to having to bypass the native escape character handling (using the raw property) in order to be able to handle newlines correctly.
There are plans to correct this in the future (see Issue #109).
All escape characters are supported when calling dedent-tabs as a function.
MIT
npm ci
- for a clean environmentnpm version patch|minor|major
- Bump version https://docs.npmjs.com/cli/v6/commands/npm-versionnpm run lint
- to ensure a consistent code stylenpm run test
- to make sure everything is workingnpm run build
- to create the bundle to releasegit commit -m "update bundle"
- to make sure the latest bundle is in the dist
directorynpm publish
FAQs
An ES6 string tag that strips indentation from multi-line strings
The npm package dedent-tabs receives a total of 1,001 weekly downloads. As such, dedent-tabs popularity was classified as popular.
We found that dedent-tabs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.