Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 1x 379x 379x 194x 263x 263x 177x 263x 91x 281x 22x 91x 1x | const Group = require('./group') class GroupBuilder { constructor() { this._groupBuilders = [] this._capturing = true } add(groupBuilder) { this._groupBuilders.push(groupBuilder) } build(match, nextGroupIndex) { const groupIndex = nextGroupIndex() const children = this._groupBuilders.map(gb => gb.build(match, nextGroupIndex) ) return new Group( match[groupIndex], match.index[groupIndex], match.index[groupIndex] + (match[groupIndex] || '').length, children ) } setNonCapturing() { this._capturing = false } get capturing() { return this._capturing } get children() { return this._groupBuilders } moveChildrenTo(groupBuilder) { this._groupBuilders.forEach(child => groupBuilder.add(child)) } } module.exports = GroupBuilder |