• Replaces consecutive whitespaces of a String with a single space

    Example

    Compact every duplicate whitespaces

    const s = compactWhitespace('  a  b  ');
    console.log(s); // ' a b '

    Returns

    the compacted String

    Parameters

    • str: string

    Returns string

Generated using TypeDoc