MCPcopy
hub / github.com/josdejong/mathjs / constructor

Method constructor

src/expression/node/BlockNode.js:23–39  ·  view source on GitHub ↗

* @constructor BlockNode * @extends {Node} * Holds a set with blocks * @param {Array.<{node: Node} | {node: Node, visible: boolean}>} blocks * An array with blocks, where a block is constructed as an * Object with properties block, which is a Node, and

(blocks)

Source from the content-addressed store, hash-verified

21 * is true by default
22 */
23 constructor (blocks) {
24 super()
25 // validate input, copy blocks
26 if (!Array.isArray(blocks)) throw new Error('Array expected')
27 this.blocks = blocks.map(function (block) {
28 const node = block && block.node
29 const visible = block &&
30 block.visible !== undefined
31 ? block.visible
32 : true
33
34 if (!isNode(node)) throw new TypeError('Property "node" must be a Node')
35 if (typeof visible !== 'boolean') { throw new TypeError('Property "visible" must be a boolean') }
36
37 return { node, visible }
38 })
39 }
40
41 static name = name
42 get type () { return name }

Callers

nothing calls this directly

Calls 2

isNodeFunction · 0.90
mapMethod · 0.65

Tested by

no test coverage detected