https://github.com/cuppilekkia/expression-tree
https://github.com/cuppilekkia/expression-tree
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cuppilekkia/expression-tree
- Owner: cuppilekkia
- Created: 2022-08-14T10:41:24.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-14T10:41:49.000Z (almost 3 years ago)
- Last Synced: 2025-02-02T09:33:25.704Z (4 months ago)
- Language: TypeScript
- Size: 45.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Part 2 – Refactoring an expression tree
⏱ We estimate that this should take 30 to 60 minutes, but please take as much or as little time as you need.
We have provided a fairly naive implementation of an expression tree for basic arithmetic in [JavaScript](#file-tree-js) and [Ruby](#file-tree-rb). Pick whichever language you feel more comfortable working in for this section.
Apply your knowledge of good software design principles to refactor and improve the design of this code.
Feel free to change anything in the file as part of your refactoring, apart from the final assertions
that consume the tree.# Solution
Install the dependencies:
```sh
npm i
```## Example
An implementation example is in `src/index.ts` and it can be run with the command:
```sh
npm run start
```## Test suite
The complete test suite is in `test/**.spec.ts`, providing coverage for the Node classes.
Run all the tests with:
```sh
npm test
```