mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-17 21:33:16 +08:00
acd100f3d3
* Update Code.Fragment backport * Support structs completion and show module subtype * Support sigil completion * Update changelog * Don't show completion items for hidden modules * Update Code.Fragment backport
13 lines
301 B
JavaScript
13 lines
301 B
JavaScript
/**
|
|
* Returns length of suffix in `string` that should be replaced
|
|
* with `newSuffix` to avoid duplication.
|
|
*/
|
|
export function replacedSuffixLength(string, newSuffix) {
|
|
let suffix = newSuffix;
|
|
|
|
while (!string.endsWith(suffix)) {
|
|
suffix = suffix.slice(0, -1);
|
|
}
|
|
|
|
return suffix.length;
|
|
}
|