github.com/hernad/nomad@v1.6.112/ui/tests/utils/clean-whitespace.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  // cleans whitespace from a string, for example for cleaning
     7  // textContent in DOM nodes with indentation
     8  export default function cleanWhitespace(string) {
     9    return string.replace(/\n/g, '').replace(/ +/g, ' ').trim();
    10  }