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

Method constructor

src/expression/node/IndexNode.js:29–42  ·  view source on GitHub ↗

* @constructor IndexNode * @extends Node * * Describes a subset of a matrix or an object property. * Cannot be used on its own, needs to be used within an AccessorNode or * AssignmentNode. * * @param {Node[]} dimensions * @param {boolean} [dotNotation=false]

(dimensions, dotNotation)

Source from the content-addressed store, hash-verified

27 * (which is the default). This property is used for string conversion.
28 */
29 constructor (dimensions, dotNotation) {
30 super()
31 this.dimensions = dimensions
32 this.dotNotation = dotNotation || false
33
34 // validate input
35 if (!Array.isArray(dimensions) || !dimensions.every(isNode)) {
36 throw new TypeError(
37 'Array containing Nodes expected for parameter "dimensions"')
38 }
39 if (this.dotNotation && !this.isObjectProperty()) {
40 throw new Error('dotNotation only applicable for object properties')
41 }
42 }
43
44 static name = name
45 get type () { return name }

Callers

nothing calls this directly

Calls 1

isObjectPropertyMethod · 0.95

Tested by

no test coverage detected