14 Commits

Author SHA1 Message Date
Ramesh Vijayaraghavan
c7f4c53483
Support for Percentage Operation (#2304)
* Support for Percentage Operation

* Fixed Style issue

* Added Test case to check for modulo followed by pi

* Support for % addition and % subtraction

* Fixed Documentation comment

* Support - Should not calculate mod for negative divisor

* Updated Docs

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2021-09-22 11:45:37 +02:00
davidtranhq
f79fec6db5
Fix ArrayNode.toTex(): Remove the row delimiter on the last row (#2267)
* fix toTex(): remove row delimiter on the last row

* remove row delimiter on the last row (use map and join instead of forEach)

* fix ArrayNode.toTex() unit tests incorrectly expecting a row delimiter on the last row

* added toTex() tests for nested cases

* fixed ArrayNode.toTex() for nested cases

* removed redunant variable
2021-07-03 12:10:22 +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
c6cbf55389 Fix #2150, #660: give a clear error "Error: Undefined function ..." instead when
evaluating a non-existing function, and expose internal functions `FunctionNode.onUndefinedFunction(name)` and `SymbolNode.onUndefinedSymbol(name)`
2021-04-10 13:38:04 +02:00
Jos de Jong
41c5e2fabe Merge branch 'develop' into v8
# Conflicts:
#	HISTORY.md
#	package-lock.json
#	package.json
#	src/expression/embeddedDocs/embeddedDocs.js
#	src/factoriesAny.js
#	src/function/special/erf.js
#	src/plain/number/probability.js
#	src/version.js
2020-11-02 11:59:12 +01:00
Jos de Jong
68c6a91801 Update devDependencies 2020-11-02 09:33:11 +01:00
Jos de Jong
6f00715754
Specify import require paths (continuation of #1941) (#1962)
* Add `.js` extension to source file imports

* Specify package `exports` in `package.json`

Specify package type as `commonjs` (It's good to be specific)

* Move all compiled scripts into `lib` directory

Remove ./number.js (You can use the compiled ones in `./lib/*`)

Tell node that the `esm` directory is type `module` and enable tree shaking.

Remove unused files from packages `files` property

* Allow importing of package.json

* Make library ESM first

* - Fix merge conflicts
- Refactor `bundleAny` into `defaultInstance.js` and `browserBundle.cjs`
- Refactor unit tests to be able to run with plain nodejs (no transpiling)
- Fix browser examples

* Fix browser and browserstack tests

* Fix running unit tests on Node 10 (which has no support for modules)

* Fix node.js examples (those are still commonjs)

* Remove the need for `browserBundle.cjs`

* Generate minified bundle only

* [Security] Bump node-fetch from 2.6.0 to 2.6.1 (#1963)

Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. **This update includes a security fix.**
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Cleanup console.log

* Add integration tests to test the entry points (commonjs/esm, full/number only)

* Create backward compatibility error messages in the files moved/removed since v8

* Describe breaking changes in HISTORY.md

* Bump karma from 5.2.1 to 5.2.2 (#1965)

Bumps [karma](https://github.com/karma-runner/karma) from 5.2.1 to 5.2.2.
- [Release notes](https://github.com/karma-runner/karma/releases)
- [Changelog](https://github.com/karma-runner/karma/blob/master/CHANGELOG.md)
- [Commits](https://github.com/karma-runner/karma/compare/v5.2.1...v5.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

Co-authored-by: Lee Langley-Rees <lee@greenimp.co.uk>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-09-20 18:01:29 +02:00
josdejong
6038d12e29 Fix #1842: value Infinity not turned into the latex symbol \\infty 2020-05-04 20:50:27 +02:00
Rian McGuire
a8d94cbbeb Copy IndexNode dotNotation property in map and clone methods (#1623)
* Copy dotNotation in IndexNode.prototype.map

* Copy dotNotation in IndexNode.prototype.clone
2019-09-20 20:11:18 +02:00
Harry Sarson
e0adfb3e37 Ignore use of template literals in normal strings for latex
Mathjs latex uses same syntax as template literals, thus we need to
ignore some otherwise helpful rules that look for template literal
syntax in normal strings.
2019-08-21 10:09:10 +01:00
Harry Sarson
b6a42c032d run standard --fix 2019-08-21 10:09:10 +01:00
jos
d8a4f3a00a Update to standard@13.0.2 2019-07-20 13:46:31 +02:00
jos
deb7c05b53 Fix #1550: nested user defined function not receiving variables of an outer user defined function 2019-07-07 10:56:01 +02:00
jos
db4910bed4 Move all test related stuff in folder test 2019-06-05 11:45:02 +02:00