MCPcopy Index your code
hub / github.com/processing/p5.js / isPerfectSquare

Function isPerfectSquare

src/math/Matrices/Matrix.js:8–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import { MatrixInterface } from './MatrixInterface';
7
8const isPerfectSquare = arr => {
9 const sqDimention = Math.sqrt(arr.length);
10 if (sqDimention % 1 !== 0) {
11 throw new Error('Array length must be a perfect square.');
12 }
13 return true;
14};
15
16export let GLMAT_ARRAY_TYPE = Array;
17export let isMatrixArray = x => Array.isArray(x);

Callers 2

constructorMethod · 0.85
multMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected