This repo contains a brief assessment of Javascript and Typescript for engineering candidates applying to The Trevor Project. The goal is to take a look at the /src/index.ts
file that contains a number of functions in it. Each function is written in a somewhat less-than-ideal manner. There could be performance improvements in some or readability improvements in others. The objective is to refactor the functions in a way the candidate feels is appropriate and/or get broken function working so they pass the tests.
Some principles to keep in mind that might be helpful:
- Performance
- Readability
- Scalability
- Stewardship
- DRY principles
- Proper abstraction
- Functional/Declarative programming principles (optional but encouraged)
- Formatting and linting
- Leverage native language constructs
- Testability of code/functions
- Language standards compliance
- Proper typing
- TypeScript considerations
- Comments as necessary
- Error checking and resilience
This is a very subjective exercise but there is also a lot of room for improvement in the code from most of the suggestions above. Feel free to change variables, flow, add functions, modify logic, make assumptions about use, etc. as long as the tests still pass. You may find that by changing some code, you will also need to change some Typescript declarations. You are also welcome to create new helpers/modules or install new NPM packages if you deem appropriate.
We encourage copious comments to explain your code changes. Target your explanations as if they were geared towards a Jr Software Engineer. It may be that you see perfectly good code and that’s fine as long as you can explain why you feel that way. We highly suggest that you leverage the linting options already enabled in the repo.
This template comes packaged with a start
and watch-and-run
NPM script.
npm start
- TSC compile and run the index.ts file in non-watch mode.
npm run watch-and-run
- TSC compile and run your index.js in watch mode which will recompile and restart the server on file changes.
npm test
- Run TSC and execute all *.test.ts
files.
- Fork the repo into your GitHub account and add the user
linuxdream
as a collaborator. - Create a new branch off main called improvements and submit a PR with your improvements.
- Tag us as reviewers!