biome format --write
This commit is contained in:
parent
8372348148
commit
9262e803ec
415 changed files with 54076 additions and 17419 deletions
|
|
@ -12,26 +12,30 @@ export const wordAtPosition = (str, pos) => {
|
|||
}
|
||||
|
||||
export const addPositionToWords = (words) => {
|
||||
return reduce(words, (result, word) => {
|
||||
const data = {
|
||||
word,
|
||||
start: 0,
|
||||
end: word.length
|
||||
}
|
||||
return reduce(
|
||||
words,
|
||||
(result, word) => {
|
||||
const data = {
|
||||
word,
|
||||
start: 0,
|
||||
end: word.length,
|
||||
}
|
||||
|
||||
if (result.length > 0) {
|
||||
const previous = result.pop()
|
||||
if (result.length > 0) {
|
||||
const previous = result.pop()
|
||||
|
||||
data.start += previous.end
|
||||
data.end += previous.end
|
||||
data.start += previous.end
|
||||
data.end += previous.end
|
||||
|
||||
result.push(previous)
|
||||
}
|
||||
result.push(previous)
|
||||
}
|
||||
|
||||
result.push(data)
|
||||
result.push(data)
|
||||
|
||||
return result
|
||||
}, [])
|
||||
return result
|
||||
},
|
||||
[],
|
||||
)
|
||||
}
|
||||
|
||||
export const splitByWhitespaceBoundary = (str) => {
|
||||
|
|
@ -64,7 +68,7 @@ const completion = {
|
|||
wordAtPosition,
|
||||
addPositionToWords,
|
||||
splitByWhitespaceBoundary,
|
||||
replaceWord
|
||||
replaceWord,
|
||||
}
|
||||
|
||||
export default completion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue