repo
replacements.fyi

// package

min-indent

type: "module"

// preferences

// replacements (1)

snippet::min-indent

Simple or drop-in replacement

This package is no longer necessary. You can use a regular expression with `Array.prototype.reduce` to find the shortest leading whitespace across the lines of a string.

// example

const minIndent = (string) =>
	(
		string.match(/^[ \t]*(?=\S)/gm) ?? ['']
	).reduce(
		(r, a) => Math.min(r, a.length),
		Infinity,
	);