MCPcopy Create free account
hub / github.com/cryptii/cryptii / removeBrick

Method removeBrick

src/Pipe.js:268–279  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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.

Callers 2

Pipe.jsFile · 0.80
viewMenuItemDidClickMethod · 0.80

Calls 2

spliceBricksMethod · 0.95
indexOfMethod · 0.80

Tested by

no test coverage detected