github.com/hernad/nomad@v1.6.112/ui/tests/helpers/collapse-whitespace.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 export default function (string) { 7 return string 8 .replace(/[\t\r\n]/g, ' ') 9 .replace(/ +/g, ' ') 10 .replace(/^ /, '') 11 .replace(/ $/, ''); 12 }