Skip to content

joinLines

Import from @varavel/vdl-plugin-sdk/utils/strings.

function joinLines(lines): string;

Joins lines into one string after removing blank entries.

A line is considered blank when it is empty or contains only whitespace. Non-blank lines keep their original content and ordering.

Parameters

Parameter Type Description
lines string[] Array of lines to normalize and join.

Returns

string

The resulting multi-line string with blank lines removed.

Example

joinLines(["first", "", "  ", "second"]);
// returns "first\nsecond"