josdejong / josdejong/mathjs

Document developer requirements/guidelines for the Number bundle

Open
#3,559 4 comments 0 reactions 0 assignees View on GitHub
documentation good first issue
Dominant language
JavaScript
Stars
15.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Recently, I have just been throwing any mathjs methods I create into the number bundle with their standard factories, on the theory that if their factory defines implementations for other types, those will just be ignored when the number-only instance is generated.

However, I was working on adding a `scalarDivide()` function (which would check if one vector is a scalar multiple of another, e.g., `scalarDivide([1.5, 3], [1, 2]) = 1.5` but `scalarDivide([2, 3], [1, 2]) = undefined`), and I went to add it to factoriesNumber and discovered that neither `dotMultiply` nor `dotDivide` is in the number bundle. Yet these operations make perfect sense for ordinary arrays of numbers. So, it would be helpful to have some clarification:

1) What is the criterion for a method to be included in the number bundle? Should `dotMultiply` and `dotDivide` be added, and the list of functions scanned for others that should be added? Or perhaps are there methods now in the number bundle that should be removed?

2) Is there/could there be automated testing for what is and isn't in the number bundle?

3) When does the implementation need to be changed for inclusion in the number bundle vs. when can the same factory just be included in factoriesNumber as in factoriesAny?

This guidance should be added to the "Implementing a new function" section of the README.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.