Skip to content

Wrapping multiline text #27

Open
@fcastilloec

Description

I'm having trouble understanding how this module works with multiline text and I feel the current behavior has a bug.
Here's an example:

const wrap = require('word-wrap')
const test = `Highlights:\n First\n Second\n Third`

result = wrap(test, {width: 80}, indent: '*');

The output I get is *Highlights:\n \n*First\n \n*Second\n \n*Third but what I expected was *Highlights:\n\n* First\n\n* Second\n\n* Third. Why are the spaces after a newline being included in the previous line? Is this a bug?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions