Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redent

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redent

Strip redundant indentation and indent the string

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is redent?

The npm package 'redent' is used to modify the indentation of a string. It can remove excess indentation and add desired indentation to each line of a given text. This is particularly useful when working with multi-line strings in programming environments where indentation matters, such as in source code or markdown files.

What are redent's main functionalities?

Remove excess indentation

This feature removes excess indentation from a text. The example shows how to use redent to dedent a string to the least indented line.

const redent = require('redent');

const text = '    foo\n        bar';
const dedentedText = redent(text, 0);
console.log(dedentedText); // 'foo\n    bar'

Add indentation

This feature adds a specified number of spaces to the beginning of each line in the text. The example demonstrates adding 4 spaces of indentation to each line of a string.

const redent = require('redent');

const text = 'foo\nbar';
const indentedText = redent(text, 4);
console.log(indentedText); // '    foo\n    bar'

Other packages similar to redent

Keywords

FAQs

Package last updated on 03 May 2021

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