61 Commits

Author SHA1 Message Date
Jos de Jong
2bb678460e docs: let the custom set method return the right map in the example custom_scope_objects.js and an internal tool (see #3490) 2025-06-11 09:34:27 +02:00
Jos de Jong
a1eec936fc
feat: export util functions for maps and improve documentation of scope (#3243)
* feat: export util functions `isMap`, `isPartitionedMap`, and `isObjectWrappingMap` and improve the documentation of `scope` (see #3150)

* chore: fix broken unit tests

* docs: refine the explanation about scopes
2024-08-01 10:57:23 +02:00
Jos de Jong
0602198540 docs: fix example convert_fraction_to_bignumber.js by upgrading to typed-function@4.2.1 2024-06-05 11:04:24 +02:00
Jos de Jong
fb6d4d9eea fix: example advanced/custom_argument_parsing.js 2024-05-31 16:49:17 +02:00
Jos de Jong
ab3461d484
feat: implement support for bigint (#3207, #2737) 2024-05-31 12:43:09 +02:00
Jos de Jong
1f05a35d68
chore: convert CJS files to ESM (#3204) 2024-05-22 08:46:14 +02:00
Vrushaket Chaudhari
8f8e506166
feat: implement subtractScalar (#3081, #2643)
* added subtractScaler

* added subtractScaler missing entries

* added test cases for 2 or more parameters, test for subtractScalar instead fo subtract

* replaced subtract with subtractScalar whereever possible

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2023-10-25 13:46:58 +02:00
Jos de Jong
cb168f60d9 Fix #2876: use the number only implementation of mathjs in example custom_evaluate_using_factories.js 2023-01-13 15:33:40 +01:00
Jos de Jong
cc20bacec1 Fix #2144: examples/advanced/custom_loading.js was broken 2022-08-18 14:41:14 +02:00
Jos de Jong
b18f4d4f54 Fix custom loading example (rename to .mjs), see #2447, #2144 2022-08-18 14:24:23 +02:00
Jos de Jong
780bde7ed5 Extend example custom_datatype.js demoing it a bit more 2021-06-23 09:15:31 +02:00
Jos de Jong
69e395cd2f Extend example custom_datatype.js demoing it a bit more 2021-06-23 09:14:49 +02:00
jhugman
e80995d52d
Add support for scopes with get and set methods (#2166)
* Add support for scopes with get and set methods

* Fix build for node v12

* Fixup cli and parser tests

* Add tests for simplify and evaluate

* Add example for a custom scope object

* Function calls need child scopes

* Transitionary step: Separate Safe and Scope Property calls

* Renamed identifiers in FunctionNode

* Evaluate with ObjectScopeWrapper

* Simplify tests passing

* Assume all scopes are map-like. Except parser

* Remove isMapLike check in customs.*SafeProperty() methods

* Change MapLike to Map

* Move keywords from an Object to a Set

* Move ScopeProperty functions in to scope.js

* Removed deprecation warning

* Rename scope.js to map.js

* Rename ScopeProperty to MapProperty

* Add tests and docs for map.js

* Put back the micro-optimization of function calls

* Use Map in the parser

* Called scope methods directly in cli.js

* Coercing of scope into a Map is done in Node, not evaluate

* Move createSubScope to its own file

* Fixup following self-review

* Add scope docs

* Final self-review changes

* Address reviewer comments

* Remove MapProperty witness marks

* Converted broken benchmark possibly lost in a rebase

* Use bare map as scope in benchmark

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2021-05-16 13:33:01 +02:00
Jos de Jong
d82fc392ac Simplify require url in math_worker example 2020-09-26 11:29:11 +02:00
Jos de Jong
91fa8ea5aa Fix require url in math_worker example 2020-09-26 11:28:25 +02:00
josdejong
2df28bb609 Fix #1899: documentation on expression trees still using old namespace
`math.expression.node.*` instead of `math.*`
2020-06-28 22:14:27 +02:00
josdejong
7b5038eb89 Update devDependencies. Fix linting error 2020-06-23 21:09:38 +02:00
josdejong
f8521d3344 Add two examples on creating a custom instance of evaluate 2020-06-23 21:00:10 +02:00
jos
d8a4f3a00a Update to standard@13.0.2 2019-07-20 13:46:31 +02:00
jos
c74a736ff9 Create an example showing how to override relational functions, see #1557 2019-07-10 12:20:50 +02:00
jos
a602a38340 Updated docs for v6 2019-05-20 21:42:49 +02:00
jos
794803c0cd Updated readme, history, and some examples 2019-04-30 21:06:08 +02:00
jos
e4bb1c6198 Generate individual files for dependencies (tree shaking working now :) ) 2019-04-24 21:13:49 +02:00
jos
ecaa30c05e Update urls of examples to point to root instead of index.js 2019-04-24 10:50:54 +02:00
jos
f4d4180cea Move all entry files under ./src/entry 2019-04-24 10:48:01 +02:00
jos
33cead1327 Improved deprecation errors and warnings. Introduce lazy again for factories. 2019-04-22 09:45:57 +02:00
jos
d8957d23ae Get all examples running :) 2019-04-10 16:52:02 +02:00
jos
2d15621a3b Fixes in examples (WIP) 2019-02-11 21:38:53 +01:00
jos
99da53da0e Flatten everything in a mathjs instance to make it consistent with the ES6 exports. Create deprecation warnings for the old classes and functions 2019-02-07 21:24:51 +01:00
jos
078f1dd69f Renamed methods .eval to .evaluate, updated all docs and examples accordingly 2019-01-16 10:11:32 +01:00
jos
046173c531 Converted all arithmetic functions 2018-11-06 13:13:52 +01:00
jos
f6b524a966 Use object destructuring in factory function callback. Rename typeof to typeOf. Only pass dependencies in scope to factory function. 2018-11-06 09:17:21 +01:00
jos
51960aafe0 Change the structure of a factory function from an function to an object with meta data 2018-11-05 10:25:32 +01:00
jos
7d2c87be04 Move plain functions under ./src/plain 2018-10-31 11:37:02 +01:00
jos
3019b4a526 Merge branch 'develop' into modular_architecture 2018-10-20 18:25:43 +02:00
jos
a715786690 Release v5.2.0 2018-10-05 21:25:21 +02:00
jos
c13466bd0a Merge branch 'develop' into modular_architecture 2018-09-21 20:11:47 +02:00
greenkeeper[bot]
c5971b371a Update standard to the latest version 🚀 (#1226)
* chore(package): update standard to version 12.0.0

* update to new lint version with --fix

I believe this mainly adds whitespace to `{}`'s.

* Replace assert.equal with assert.strictEqual

This breaks a lot of tests which I will endevour to fix in the next
commits.

* Fix most errors due to assert.strictEquals

Some instances of `strictEquals` are replaced by `deepEquals`.
`toString` has been used to make some string comparisions explicit.
Tests will still fail untill #1236 and #1237 are fixed.

* Fix assertion erros due to -0

With node 10, assert.strictEqual no longer considers `0 === -0`.
I missed these first time round as I was using node 8.

* Put toString correct side of bracket

I was converting the constructor to a string rather
than the result of the computation. Oops.

* Fixed #1236: quantileSeq has inconsistant return

* Update package-lock

* Fixed #1237: norm sometimes returning a complex number instead of number

* Fix cli tests

* More changes for standardjs, and fixes in unit tests
2018-09-08 16:33:58 +02:00
jos
5610c72e84 Experiment with different dependency injection (WIP) 2018-07-28 22:21:33 +02:00
jos
3ee6201981 Fixed advanced example add_new_datatypes, upgraded dependencies 2018-07-04 12:26:38 +02:00
jos
dff0a57219 Some fixes in examples 2018-06-16 14:32:47 +02:00
jos
88263c47c7 Woohoo fixed the last lint errors 2018-06-13 21:51:09 +02:00
jos
b6b36bfd9b Use strict equality checks everywhere (=== and !==) 2018-06-13 15:02:21 +02:00
jos
b3b96749bf Refactored var into const/let, and removed a lot of semicolons 2018-06-13 12:21:14 +02:00
jos
024b2a9e26 Fix most lint errors using npx standard --fix 2018-06-10 20:28:27 +02:00
jos
a7751f72a5 Update/fix examples where needed 2018-02-04 15:05:00 +01:00
jos
be913efa29 Added docs and example on making the expression parser less vulnerable 2017-05-12 12:15:46 +02:00
jos
15aca5e4d0 Changed casing of the values of config options number and matrix to match the actual name of the classes. 2016-03-04 19:41:54 +01:00
jos
e2a3878ba9 Moved functions format and print to section string 2016-03-03 20:17:41 +01:00
jos
4ea2542941 Extended math.fraction with support for BigNumber, extended math.bignumber with support for Fraction 2016-03-03 19:24:24 +01:00