An open API service indexing awesome lists of open source software.

https://github.com/cuppilekkia/expression-tree


https://github.com/cuppilekkia/expression-tree

Last synced: 2 months ago
JSON representation

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
```