@cnamts/vue-dot
Version:
Implementation of our Design System for the French Health Insurance
9 lines (8 loc) • 308 B
text/typescript
/**
* Insert string at a specific position
* If the position doesn't exists, the replacement
* will be inserted at the end or the start
*/
export function insertAt(source: string, index: number, replacement: string): string {
return source.substring(0, index) + replacement + source.substring(index);
}