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

min-indent

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

min-indent

Get the shortest leading whitespace from lines in a string

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16M
decreased by-14.31%
Maintainers
2
Weekly downloads
 
Created

What is min-indent?

The min-indent npm package is designed to determine the smallest indentation of non-empty lines in a given string. This is particularly useful in scenarios where consistent text formatting is required, or when preparing text for further processing that is sensitive to leading whitespace.

What are min-indent's main functionalities?

Detect minimum indentation

This feature allows you to find the smallest number of leading spaces in a multi-line string. It's useful for adjusting the text indentation level or preprocessing before rendering in UI components.

const minIndent = require('min-indent');

const sampleText = `    line one
  line two
    line three`;
const minimumIndentation = minIndent(sampleText);
console.log(minimumIndentation); // Outputs: 2

Other packages similar to min-indent

Keywords

FAQs

Package last updated on 28 May 2020

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