Skip to main content

Replace all tab characters with spaces

JavaScript version

const replace = (str, numSpaces = 4) => str.replaceAll('\t', ' '.repeat(numSpaces));

TypeScript version

const replace = (str: string, numSpaces = 4): string => str.replaceAll('\t', ' '.repeat(numSpaces));

Comments