Socket
Socket
Sign inDemoInstall

de-indent

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

de-indent

remove extra indent from a block of code


Version published
Weekly downloads
2.6M
decreased by-18.48%
Maintainers
1
Weekly downloads
 
Created

What is de-indent?

The de-indent npm package is a utility for removing leading indentation from multiline strings. This can be particularly useful when dealing with template literals in JavaScript, where you want to maintain readability in your code without preserving the indentation in the resulting string.

What are de-indent's main functionalities?

Basic De-indentation

This feature removes the leading indentation from a multiline string, making it easier to work with template literals without preserving the indentation in the final string.

const deindent = require('de-indent');
const indentedString = `
    function example() {
        console.log('Hello, world!');
    }
`;
const result = deindent(indentedString);
console.log(result);

De-indentation with Template Literals

This feature is useful for de-indenting HTML or XML strings defined using template literals, making the code more readable while ensuring the final string has no leading spaces.

const deindent = require('de-indent');
const indentedString = `
    <div>
        <p>Hello, world!</p>
    </div>
`;
const result = deindent(indentedString);
console.log(result);

Other packages similar to de-indent

Keywords

FAQs

Package last updated on 05 Jan 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc