MCPcopy Index your code
hub / github.com/josdejong/mathjs / validateIndexSourceSize

Function validateIndexSourceSize

src/utils/array.js:89–96  ·  view source on GitHub ↗
(value, index)

Source from the content-addressed store, hash-verified

87 * @throws DimensionError
88 */
89export function validateIndexSourceSize (value, index) {
90 const valueSize = value.isMatrix ? value._size : arraySize(value)
91 const sourceSize = index._sourceSize
92 // checks if the source size is not null and matches the valueSize
93 sourceSize.forEach((sourceDim, i) => {
94 if (sourceDim !== null && sourceDim !== valueSize[i]) { throw new DimensionError(sourceDim, valueSize[i]) }
95 })
96}
97
98/**
99 * Test whether index is an integer number with index >= 0 and index < length

Callers 3

subset.jsFile · 0.90
_getSubstringFunction · 0.90
_setSubstringFunction · 0.90

Calls 2

arraySizeFunction · 0.85
forEachMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…