А есть что-то типа?
horizontalWords () {
const words = []
let row = 1
for (row; row <= this.width; row++) {
const rowBlankCells = this.blanks
.filter((cell) => Number(cell.split(':')[1]) === row)
.map((cell) => Number(cell.split(':')[0]))
if (rowBlankCells.length > 0) {
let i = 1
const cols = new Array(this.height).fill(0).map((col) => i++)
if (cols) {
`:${cols.join('::')}:`
.split(new RegExp(`:${rowBlankCells.join(':|:')}:`))
.filter((word) => {
const match = word.match(/:\d+:/g)
return match ? match.length > 1 : false
})
.forEach((word) => {
const match = word.match(/:\d+:/g)
const length = match ? match.length : 0
words.push({
x: Number(word.match(/^:(\d+)/)[1]),
y: row,
type: 'horizontal',
length,
question: '',
})
})
}
} else {
words.push({
x: 1,
y: row,
type: 'horizontal',
length: this.width,
question: '',
})
}
}
return words
},
Вот это лапша или нет?
Denis
Vyacheslav
Андрей
Anonymous
Nikolay
Anastasia