72 Commits

Author SHA1 Message Date
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
6621159e8d Update years in copyright from 2020 to 2021 2021-01-01 15:43: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
jos
b3236b6592 Publish v6.4.0 2020-01-06 20:03:52 +01:00
jos
d8a4f3a00a Update to standard@13.0.2 2019-07-20 13:46:31 +02:00
jos
ab1b83a2f6 Remove generated files from repo, make tests independent from generated files 2019-05-12 15:14:13 +02:00
jos
ad51c22066 Fix embedded docs warnings. Fix CLI auto completion on non-supported classes 2019-05-04 09:54:12 +02:00
jos
427c39c33b Created ES5 and ES6 entry points 2019-04-28 20:56:08 +02:00
jos
f1d4eac528 Fix links to mainBundle in cli and repl 2019-04-24 11:18:57 +02:00
jos
6081360d6a Merged develop into modular_architecture 2019-04-13 16:51:51 +02:00
jos
70cbc3ec30 Replace http urls with https where supported 2019-02-27 13:08:42 +01:00
jos
83df09800b Merge branch 'develop' into modular_architecture_merge
# Conflicts:
#	HISTORY.md
#	gulpfile.js
#	package-lock.json
#	package.json
#	src/core/function/typed.js
#	src/expression/transform/index.js
#	src/function/statistics/sum.js
#	src/function/utils/index.js
#	src/type/unit/Unit.js
#	src/version.js
#	test/expression/node/FunctionNode.test.js
#	test/type/unit/function/createUnit.test.js
#	test/utils/bignumber/formatter.test.js
#	test/utils/number.test.js
2019-02-09 21:26:25 +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
ec0f9bd715 Publish v5.4.1 2019-01-10 22:07:03 +01:00
jos
9f3ec22ec8 Get bundles, bin, cli, and all travis tests working again 🎉 2019-01-09 11:36:03 +01: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
88263c47c7 Woohoo fixed the last lint errors 2018-06-13 21:51:09 +02:00
jos
b0ec2d4739 Fixed undefined variables/globals 2018-06-13 18:09:19 +02:00
jos
4254b7413f Dropped support for (non-primitive) instances of Number, Boolean, and String from functions clone and typeof 2018-06-13 17:56:18 +02:00
jos
b6b36bfd9b Use strict equality checks everywhere (=== and !==) 2018-06-13 15:02:21 +02:00
jos
6d340e0faa Fixed import.js not being documented correctly in the function reference 2018-06-13 13:34:27 +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
e99fb2d481 Released v3.19.0 2018-01-06 20:19:45 +01:00
jos
967e65cceb Refactored usage of properties .isNode, .isSymbolNode, etc. into using functions like type.isNode(x) for security 2017-08-12 14:38:03 +02:00
jos
949261f92b Refactored usage of properties .isRange, .isIndex, .isResultSet, and .isHelp for their (safe) function equivalents 2017-08-12 13:31:09 +02:00
slavaGanzin
fa3aa92156 add tests 2017-05-08 15:15:20 +03:00
slavaGanzin
61db2e889c cli: fix evaluate help message 2017-05-04 22:21:51 +03:00
slavaGanzin
074dbcda9d cli: stringify inline evaluation 2017-05-04 22:15:46 +03:00
slavaGanzin
8ef5b3bedd cli: inline evaluate 2017-05-04 19:41:44 +03:00
jos
8b701aac41 Ehh it's 2017 now 2017-01-23 22:17:45 +01:00
jos
cc1a6925af Command Line Interface loads faster 2016-10-30 20:41:53 +01:00
jos
1dd3a0e492 Expression parser now allows assignments inside objects, indexes, and function arguments 2016-03-03 19:25:42 +01:00
jos
ed0a3b9e9a Updated CLI for new AssignmentNode 2016-02-26 20:28:36 +01:00
jos
164ace3ef6 Improved handling of result sets 2016-01-09 12:48:02 +01:00
jos
a177a5a2f3 CLI outputs the variable name of assignments 2016-01-08 22:36:33 +01:00
jos
9fc1453a6e Fixed non-working autocompletion of user defined variables in the command line interface 2016-01-08 22:26:38 +01:00
jos
15b640fcea Merge branch 'develop' into feature/objectsupport
Conflicts:
	HISTORY.md
2016-01-08 20:33:22 +01:00
jos
5911fe6ffd Released version 2.6.0 2016-01-08 20:23:52 +01:00
jos
c792136b2d The command line interface does no longer round BigNumbers to 14 digits as it does with numbers 2016-01-03 17:08:51 +01:00
jos
92f3f74dc4 Removed prefix 'v' from version outputted by CLI 2015-10-30 11:43:21 +01:00
jos
577b1bf694 Minor refactoring in cli. Fixed output of version being prefixed with "> " 2015-07-31 14:16:28 +02:00
jos
a92b978036 Merged develop into v2 2015-06-07 15:57:41 +02:00
Max Bruckner
4304030a31 Expose the parenthesis option via the command line 2015-05-17 15:22:02 +02:00
jos
b32b89f94c Moved help/docs related stuff to ./lib/expression 2015-05-05 14:01:38 +02:00
Max Bruckner
231c16bfd0 Add REPL (Read Evaluate Print Loop) to ease interactive debugging 2015-04-26 14:27:05 +02:00
Max Bruckner
f9a2118da0 bin/cli: Add execute permission 2015-04-26 00:44:26 +02:00
Max Bruckner
a625137a20 cli: implement --tex and --string options 2015-04-24 13:32:04 +02:00
Max Bruckner
abeecacd55 cli: infrastructure for parsing multiple commandline options
As a side effect this enables specifying multiple scripts.
2015-04-24 13:07:25 +02:00