Files
nomad/ui/tests/utils/clean-whitespace.js
2023-08-10 17:27:29 -05:00

11 lines
300 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
// cleans whitespace from a string, for example for cleaning
// textContent in DOM nodes with indentation
export default function cleanWhitespace(string) {
return string.replace(/\n/g, '').replace(/ +/g, ' ').trim();
}