@trivago/prettier-plugin-sort-imports
Version:
A prettier plugins to sort imports in provided RegEx order
15 lines (14 loc) • 395 B
JavaScript
/**
* Replaces the contents of a string (str) at a given index with the replacement string - writes over as much text
* as the replacement string's length
*
* @param str
* @param index
* @param replacement
* @returns
*/
export function replaceAt(str, index, replacement) {
return (str.substring(0, index) +
replacement +
str.substring(index + replacement.length));
}