Skip to content

Home

Expand tabs into spaces

Convert tabs to spaces, where each tab corresponds to count spaces.

const expandTabs = (str, count) => str.replace(/\t/g, ' '.repeat(count));

expandTabs('\t\tlorem', 3); // '      lorem'

More like this

Start typing a keyphrase to see matching snippets.