Skip to content

[Replacement]: indent-string #1017

Closed

Description

@outslept

Package to replace

indent-string

Suggested replacement(s)

const indentString = (string, count = 1, indent = ' ') =>
  string.replace(/^(?!\s*$)/gm, indent.repeat(count));

Manifest type

micro-utility (tiny utility replaceable with native code or removal)

Rationale

inlinable

Availability

No response

Code example (optional)

Activity

  1. added
    accepted
    on Aug 27, 2026
  2. dreyfus92 commented on Aug 27, 2026

    @dreyfus92
    Member

    it is worth noting that the package has an includeEmptyLines option that swaps the regex to /^/gm. the docs entry should mention that or show both variants 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions