indent-string

  • Version 5.0.0
  • Published
  • 4.74 kB
  • No dependencies
  • MIT license

Install

npm i indent-string
yarn add indent-string
pnpm add indent-string

Overview

Indent each line in a string

Index

Functions

function indentString

indentString: (string: string, count?: number, options?: Options) => string;
  • Indent each line in a string.

    Parameter string

    The string to indent.

    Parameter count

    How many times you want options.indent repeated. Default: 1.

    Example 1

    import indentString from 'indent-string';
    indentString('Unicorns\nRainbows', 4);
    //=> ' Unicorns\n Rainbows'
    indentString('Unicorns\nRainbows', 4, {indent: '♥'});
    //=> '♥♥♥♥Unicorns\n♥♥♥♥Rainbows'

Interfaces

interface Options

interface Options {}

    property includeEmptyLines

    readonly includeEmptyLines?: boolean;
    • Also indent empty lines.

      false

    property indent

    readonly indent?: string;
    • The string to use for the indent.

      ' '

    Package Files (1)

    Dependencies (0)

    No dependencies.

    Dev Dependencies (3)

    Peer Dependencies (0)

    No peer dependencies.

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/indent-string.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/indent-string)
    • HTML
      <a href="https://www.jsdocs.io/package/indent-string"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>