* refactor: simplify flatten function using Array.prototype.flat
* Added fallback
* added option to flatten arrays with homogeneous size
* Typos in array.js and array.test.js
* fix types in jsdocs
* Renamed variable
* Reverted to original form
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* fix: disable parser functions in the CLI (security issue)
* fix: ensure `ObjectWrappingMap` doesn't allow deleting unsafe properties (security issue)
* fix: enable using methods and (safe) properties on plain arrays
* docs: update the "Less vulnerable expression parser" section in the docs
* chore: fix typos and linting issues
* chore: keep functions like `simplify` enabled in the CLI
* docs: update the security page
* fix: ensure `ObjectWrappingMap.keys` cannot list unsafe properties
* fix: when overwriting a rawArgs function with a non-rawArgs function it was still called with raw arguments
* docs: fix a typo
* Removed maxArgumentCount in favor of applyCallback
* Making a pure _recurse function
* Added cbrt tests, removed unnecesary changes in functions.
* Fixed main bottleneck
* Restored back function before unintended change
* Fix format
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* 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
* nearlyEqual with absolute and relative tolerances
* Format
* nearlyEqual for bigNumber
* Added skip for NaN
* Reduce diff a bit
* Issue with examples in jsdcos
* Updated all calls for nearlyEqual
* Fixed failing tests
* Changed epsilon to relTol, absTol
* Changed references to epsilon in docs and tests
* Added warning for config.epsilon
* Fix warning in zeta.test
* Added config test
* Added sinon to test console.warn
---------
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* chore: write unit tests using `and` and `or` inside a function definition (WIP)
* fix: #3143 fix scope issues in rawArgs functions by implementing a `PartitionedMap`
* fix: add more unit tests for `ObjectWrappingMap`
* fix: don't let `ObjectWrappingMap` and `PartitionedMap` extend `Map` (risk of having non-overwritten methods)
* docs: update docs about `rawArgs` functions
* chore: refactor parsing strings to not rely on `JSON.parse`
* fix: #3073 function `format` not escaping control characters and double quotes in strings
* chore: add more unit tests
* Included math to syntax when missing
* Included solveODE
* renamed initialStep as firstStep
* Included tests for solveODE
* Test the full state instead of the final state
* Fixed issue with tolerance
* Indexing with an array of booleans
* Indexing with booleans and with empty
* Changed index embedded docs
* removed solveODE
* typos on tests
* included config.predictable
* Throws an error if the size doesn't match
* Included config predictable to get subset
* Can do replacement by broadcasting
* DenseMatrix set can broadcast first
* Added tests for broadcasted subset in the parser
* Faster cloning of deep arrays
* Included docs and better test coverage
* Test coverage for `subset`
* Removed config predictable from subset
* Removed config from index and sparseMatrix
* Redaction and typos
* Cleanup unnecesary changes
* fixed issue when there is no need to broadcast
* Inline ifs
* Included specific broadcasting test
* Reduced repetition
---------
Co-authored-by: David Contreras <david.contreras@guentner.com>
Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
* setup linting with eslint-config-standard, prettier
* [autofix] npm run lint -- --fix with new setup
* [manual] fix types/ directory errors
* [manual] fix linting errors in test/ directory
* [manual] fix single linting error in src/
* revert ts-expect-error comment change
* error on .only in mocha tests
* fix test description typo
* move some short objects to single line
* add and gitignore eslintcache
* individually suppress ts any
* set --max-warnings to 0
* extract matrices to constants
* update ts-expect-error comments
* fix(FunctionNode): Improve error message when a non-function is called
Also adds tests for as many different varieties of function calls
and their associate messages when the entity being called is not
a function as I could come up with.
Resolves#2493.
* feat(format): Add a truncate option to limit result length.
Also uses the new option in FunctionNode.js to limit the length of the value
portion of its new error messages. (As requested in review)
* docs: Add 'truncate' option to the list in the exported version of 'format'
* 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>
* Add unit parser benchmark
* Add LRU to memoize function
* Memoize _findUnit
This fixes some performance issues in my heavily-unit-parsing app.
Another idea might be to do an index of reversed unit names, and search
in that, but this is much easier to implement and still should provide
an improvement in the majority of cases (since I'd imagine that most
users tend to prefer a few units at a time, depending on their
application).
* Optimize memoize function
This should be just a little bit faster than before by using Maps, which
have less overhead than javascript objects.
* 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>