How to use the replace function from @babel/types
Find comprehensive JavaScript @babel/types.replace code examples handpicked from public code repositorys.
GitHub: devinxi/vinxi
360 361 362 363 364 365 366 367 368 369
function trimWhitespace(text) { text = text.replace(/\r/g, ""); if (/\n/g.test(text)) { text = text .split("\n") .map((t, i) => (i ? t.replace(/^\s*/g, "") : t)) .filter(s => !/^\s*$/.test(s)) .join(" "); } return text.replace(/\s+/g, " ");
2
26
0
@babel/types.identifier is the most popular function in @babel/types (20936 examples)