* Removes single brick from the pipe. * Convenience method calling Pipe.spliceBricks internally. * @param {Brick|number} brickOrIndex Brick or index to be removed * @throws {Error} If brick is not part of the pipe. * @return {Pipe} Fluent interface
(brickOrIndex)
| 266 | * @return {Pipe} Fluent interface |
| 267 | */ |
| 268 | removeBrick (brickOrIndex) { |
| 269 | let index = brickOrIndex |
| 270 | if (brickOrIndex instanceof Brick) { |
| 271 | index = this._bricks.indexOf(brickOrIndex) |
| 272 | if (index === -1) { |
| 273 | throw new Error( |
| 274 | 'Brick is not part of the pipe and thus can\'t be removed.') |
| 275 | } |
| 276 | } |
| 277 | this.spliceBricks(index, 1) |
| 278 | return this |
| 279 | } |
| 280 | |
| 281 | /** |
| 282 | * Removes bricks from the pipe. |
no test coverage detected