An extensive math library for JavaScript and Node.js
This report summarizes scanner evidence for josdejong/mathjs, a JavaScript project with 15,086 GitHub stars. SynthScan examined 163,717 lines of code across 1146 source files, recording 203 pattern matches distributed across 5 syntactic categories. The legacy adjusted pattern signal is 6.8 (Moderate pattern signal); it is not an authorship estimate.
Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.
Use each vector to guide manual verification of the underlying findings.
Can maintainers explain intent, assumptions, and trade-offs? 49 finding(s).
Are imports declared and package/API names verified? 154 finding(s).
Are wrappers, guards, and repeated structures necessary? 21 finding(s).
Which changes need focused human review? 203 finding(s).
This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.
Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.
This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.
The scanner identified 203 distinct pattern matches across 5 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | types/index.d.ts | 3388 | print( | CODE |
| HIGH | types/index.d.ts | 7086 | print( | CODE |
| HIGH⚡ | examples/expressions.js | 22 | print(evaluate('sqrt(3^2 + 4^2)')) // 5 | CODE |
| HIGH⚡ | examples/expressions.js | 23 | print(evaluate('sqrt(-4)')) // 2i | CODE |
| HIGH⚡ | examples/expressions.js | 24 | print(evaluate('2 inch to cm')) // 5.08 cm | CODE |
| HIGH⚡ | examples/expressions.js | 25 | print(evaluate('cos(45 deg)')) // 0.70711 | CODE |
| HIGH⚡ | examples/expressions.js | 29 | print(evaluate([ | CODE |
| HIGH⚡ | examples/expressions.js | 43 | print(evaluate('a * b', scope)) // 12 | CODE |
| HIGH⚡ | examples/expressions.js | 46 | print(evaluate('c = 2.3 + 4.5', scope)) // 6.8 | CODE |
| HIGH⚡ | examples/expressions.js | 47 | print(scope.c) // 6.8 | CODE |
| HIGH⚡ | examples/expressions.js | 53 | print(evaluate('hello("hero")', scope)) // "hello, hero!" | CODE |
| HIGH⚡ | examples/expressions.js | 57 | print(f(2)) // 8 | CODE |
| HIGH⚡ | examples/expressions.js | 58 | print(scope.f(2)) // 8 | CODE |
| HIGH⚡ | examples/expressions.js | 74 | print(node1.toString()) // "sqrt((3 ^ 2) + (4 ^ 2))" | CODE |
| HIGH⚡ | examples/expressions.js | 78 | print(node1.evaluate()) // 5 | CODE |
| HIGH⚡ | examples/expressions.js | 84 | print(node2.toString()) // "x ^ a" | CODE |
| HIGH⚡ | examples/expressions.js | 89 | print(code2.evaluate(scope2)) // 9 | CODE |
| HIGH⚡ | examples/expressions.js | 93 | print(code2.evaluate(scope2)) // 27 | CODE |
| HIGH⚡ | examples/expressions.js | 133 | print(myParser.evaluate('sqrt(3^2 + 4^2)')) // 5 | CODE |
| HIGH⚡ | examples/expressions.js | 134 | print(myParser.evaluate('sqrt(-4)')) // 2i | CODE |
| HIGH⚡ | examples/expressions.js | 135 | print(myParser.evaluate('2 inch to cm')) // 5.08 cm | CODE |
| HIGH⚡ | examples/expressions.js | 136 | print(myParser.evaluate('cos(45 deg)')) // 0.70710678118655 | CODE |
| HIGH⚡ | examples/expressions.js | 140 | print(myParser.evaluate('x = 7 / 2')) // 3.5 | CODE |
| HIGH⚡ | examples/expressions.js | 141 | print(myParser.evaluate('x + 3')) // 6.5 | CODE |
| HIGH⚡ | examples/expressions.js | 142 | print(myParser.evaluate('f2(x, y) = x^y')) // f2(x, y) | CODE |
| HIGH⚡ | examples/expressions.js | 143 | print(myParser.evaluate('f2(2, 3)')) // 8 | CODE |
| HIGH⚡ | examples/expressions.js | 150 | print(myParser.evaluate('k = [1, 2; 3, 4]')) // [[1, 2], [3, 4]] | CODE |
| HIGH⚡ | examples/expressions.js | 151 | print(myParser.evaluate('l = zeros(2, 2)')) // [[0, 0], [0, 0]] | CODE |
| HIGH⚡ | examples/expressions.js | 152 | print(myParser.evaluate('l[1, 1:2] = [5, 6]')) // [5, 6] | CODE |
| HIGH⚡ | examples/expressions.js | 153 | print(myParser.evaluate('l')) // [[5, 6], [0, 0]] | CODE |
| HIGH⚡ | examples/expressions.js | 154 | print(myParser.evaluate('l[2, :] = [7, 8]')) // [7, 8] | CODE |
| HIGH⚡ | examples/expressions.js | 155 | print(myParser.evaluate('l')) // [[5, 6], [7, 8]] | CODE |
| HIGH⚡ | examples/expressions.js | 156 | print(myParser.evaluate('m = k * l')) // [[19, 22], [43, 50]] | CODE |
| HIGH⚡ | examples/expressions.js | 157 | print(myParser.evaluate('n = m[2, 1]')) // 43 | CODE |
| HIGH⚡ | examples/expressions.js | 158 | print(myParser.evaluate('n = m[:, 1]')) // [[19], [43]] | CODE |
| HIGH | examples/expressions.js | 111 | print(code3.evaluate()) // 5 | CODE |
| HIGH | examples/expressions.js | 120 | print(scope3.a) // 10 | CODE |
| HIGH | examples/expressions.js | 170 | print(myParser.evaluate('i / 2')) // 250 | CODE |
| HIGH | examples/expressions.js | 174 | print(myParser.evaluate('hello("hero")')) // "hello, hero!" | CODE |
| HIGH⚡ | examples/basic_usage.js | 23 | print(round(e, 3)) // 2.718 | CODE |
| HIGH⚡ | examples/basic_usage.js | 24 | print(atan2(3, -3) / pi) // 0.75 | CODE |
| HIGH⚡ | examples/basic_usage.js | 25 | print(log(10000, 10)) // 4 | CODE |
| HIGH⚡ | examples/basic_usage.js | 26 | print(sqrt(-4)) // 2i | CODE |
| HIGH⚡ | examples/basic_usage.js | 27 | print(pow([[-1, 2], [3, 1]], 2)) // [[7, 0], [0, 7]] | CODE |
| HIGH⚡ | examples/basic_usage.js | 28 | print(derivative('x^2 + x', 'x')) // 2 * x + 1 | CODE |
| HIGH⚡ | examples/basic_usage.js | 33 | print(evaluate('1.2 * (2 + 4.5)')) // 7.8 | CODE |
| HIGH⚡ | examples/basic_usage.js | 34 | print(evaluate('12.7 cm to inch')) // 5 inch | CODE |
| HIGH⚡ | examples/basic_usage.js | 35 | print(evaluate('sin(45 deg) ^ 2')) // 0.5 | CODE |
| HIGH⚡ | examples/basic_usage.js | 36 | print(evaluate('9 / 3 + 2i')) // 3 + 2i | CODE |
| HIGH⚡ | examples/basic_usage.js | 37 | print(evaluate('det([-1, 2; 3, 1])')) // -7 | CODE |
| HIGH⚡ | examples/basic_usage.js | 46 | print(a) // 14 | CODE |
| HIGH⚡ | examples/basic_usage.js | 51 | print(add(4, [5, 6])) // number + Array, [9, 10] | CODE |
| HIGH⚡ | examples/basic_usage.js | 52 | print(multiply(unit('5 mm'), 3)) // Unit * number, 15 mm | CODE |
| HIGH⚡ | examples/basic_usage.js | 53 | print(subtract([2, 3, 4], 5)) // Array - number, [-3, -2, -1] | CODE |
| HIGH⚡ | examples/basic_usage.js | 54 | print(add(matrix([2, 3]), [4, 5])) // Matrix + Array, [6, 8] | CODE |
| HIGH⚡ | examples/import.js | 20 | print(math.myConstant * 2) // 84 | CODE |
| HIGH⚡ | examples/import.js | 21 | print(math.hello('user')) // 'hello, user!' | CODE |
| HIGH⚡ | examples/import.js | 23 | print(math.evaluate('myConstant + 10')) // 52 | CODE |
| HIGH⚡ | examples/import.js | 24 | print(math.evaluate('hello("user")')) // 'hello, user!' | CODE |
| HIGH | examples/import.js | 40 | print(math.fibonacci(7)) // 13 | CODE |
| 91 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| CRITICAL⚡ | test/unit-tests/expression/security.test.js | 235 | math.evaluate('cos.syntax="global.eval";s=unit("5 cm");s.units=[]._data;s.value=cos;s._compile=s.toString;expressi | CODE |
| CRITICAL⚡ | test/unit-tests/expression/security.test.js | 241 | math.evaluate('expression.node.ConstantNode.prototype.clone.call({"value":"evaluate"}).evaluate()("console.log(\'h | CODE |
| CRITICAL⚡ | test/unit-tests/expression/security.test.js | 247 | math.evaluate('c(x,y)="console.log(\'hacked...\')";expression.node.Node.prototype.compile.apply({_compile:c}).eval | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | gulpfile.js | 219 | function generateEntryFilesCallback (done) { | CODE |
| LOW | tools/entryGenerator.js | 192 | function generateDependenciesFiles ({ suffix, factories, entryFolder }) { | CODE |
| LOW | test/unit-tests/function/probability/random.test.js | 135 | function assertUniformDistribution (values, min, max) { | CODE |
| LOW | test/unit-tests/function/algebra/derivative.test.js | 11 | function derivativeWithoutSimplify (expr, value) { | CODE |
| LOW | …t/unit-tests/function/algebra/decomposition/qr.test.js | 59 | function assertValidQRDecomposition (A, Q, R) { | CODE |
| LOW | test/unit-tests/expression/parse.test.js | 30 | function parseAndStringifyWithParens (expr) { | CODE |
| LOW | src/factoriesNumber.js | 340 | function createNumberOptionalSecondArgFactory (name, fn) { | CODE |
| LOW⚡ | src/core/function/import.js | 370 | function hasTypedFunctionSignature (fn) { | CODE |
| LOW⚡ | src/core/function/import.js | 378 | function factoryAllowedInExpressions (factory) { | CODE |
| LOW⚡ | src/core/function/import.js | 384 | function isTransformFunctionFactory (factory) { | CODE |
| LOW | src/utils/array.js | 928 | function recursiveForEachWithIndex (value, depth) { | CODE |
| LOW | src/utils/snapshot.js | 97 | export function createSnapshotFromFactories (factories) { | CODE |
| LOW | src/utils/bignumber/bitwise.js | 215 | function decCoefficientToBinaryString (x) { | CODE |
| LOW | src/function/matrix/matrixFromColumns.js | 69 | function checkVectorTypeAndReturnLength (vec) { | CODE |
| LOW | src/function/matrix/matrixFromRows.js | 58 | function checkVectorTypeAndReturnLength (vec) { | CODE |
| LOW | src/type/number.js | 29 | function makeNumberFromNonDecimalParts (parts) { | CODE |
| LOW | src/expression/parse.js | 1065 | function parseMultiplyDivideModulus (state) { | CODE |
| LOW | src/expression/parse.js | 1101 | function parseImplicitMultiplication (state) { | CODE |
| LOW | src/expression/node/FunctionAssignmentNode.js | 107 | return function evalFunctionAssignmentNode (scope, args, context) { | CODE |
| LOW | src/expression/node/OperatorNode.js | 48 | function calculateNecessaryParentheses (root, parenthesis, implicit, args, latex) { | CODE |
| LOW | src/expression/node/RangeNode.js | 19 | function calculateNecessaryParentheses (node, parenthesis, implicit) { | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | …t/unit-tests/function/algebra/simplifyConstant.test.js | 64 | // TODO: implement support for simplification of constant sub-expressions for inverses of | COMMENT |
| LOW | test/generated-code-tests/entry/mainNumber.test.js | 140 | // TODO: implement support for subset in number implementation | COMMENT |
| LOW | bin/cli.js | 413 | // TODO: implement configuration via command line arguments | COMMENT |
| LOW | src/utils/bignumber/formatter.js | 158 | // TODO: implement support for upper and lower to be BigNumbers themselves | COMMENT |
| LOW | src/function/statistics/prod.js | 41 | // TODO: implement prod(A, dim) | COMMENT |
| LOW | src/function/statistics/median.js | 96 | // TODO: implement median(A, dim) | COMMENT |
| LOW | src/function/probability/permutations.js | 69 | // TODO: implement support for collection in permutations | COMMENT |
| LOW | src/function/probability/combinations.js | 61 | // TODO: implement support for collection in combinations | COMMENT |
| LOW | src/function/complex/arg.js | 48 | // TODO: implement BigNumber support for function arg | COMMENT |
| LOW | src/function/arithmetic/divide.js | 55 | // TODO: implement matrix right division using pseudo inverse | COMMENT |
| LOW | src/function/arithmetic/xgcd.js | 40 | // TODO: implement support for Fraction | COMMENT |
| LOW | src/function/bitwise/rightLogShift.js | 61 | // 'BigNumber, BigNumber': ..., // TODO: implement BigNumber support for rightLogShift | COMMENT |
| LOW | src/type/matrix/Range.js | 267 | // TODO: implement a caching mechanism for range.valueOf() | COMMENT |
| LOW | src/type/matrix/MatrixIndex.js | 75 | // TODO: implement support for wildcard '*' | COMMENT |
| LOW | src/expression/node/IndexNode.js | 62 | // TODO: implement support for bignumber (currently bignumbers are silently | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tools/whitelistgenerator.js | 101 | // 'cbrt': true, | COMMENT |
| LOW | …t/unit-tests/function/algebra/simplifyConstant.test.js | 61 | // collapsing of constants with a 'falsy' value (e.g. '0') | COMMENT |
| LOW | examples/expressions.js | 61 | // | COMMENT |
| LOW | examples/advanced/function_transform.js | 41 | // result: 6 | COMMENT |
| LOW | examples/advanced/custom_loading.js | 21 | // Use the created functions | COMMENT |
| LOW | examples/advanced/convert_fraction_to_bignumber.js | 1 | // Convert from Fraction to BigNumber | COMMENT |
| LOW | examples/advanced/more_secure_eval.js | 1 | // Expression parser security | COMMENT |
| LOW | src/utils/is.js | 1 | // type checks for all known types | COMMENT |
| LOW | src/function/matrix/eigs/complexEigs.js | 21 | // R is the row transformation matrix | COMMENT |
| LOW | src/function/algebra/simplify.js | 201 | phi: true, | COMMENT |
| LOW | src/function/algebra/rationalize.js | 401 | } | COMMENT |
| LOW | src/function/algebra/sparse/csAmd.js | 81 | // select node of minimum approximate degree. amd() is now ready to start eliminating the graph. It first | COMMENT |
| LOW | src/expression/operators.js | 1 | // list of identifiers of nodes in order of their precedence | COMMENT |