A lightweight javascript library for parsing calculations as an example for the revealing module pattern and testing with Jasmine.
In a browser using CDN:
<script src="https://unpkg.com/@perreh/[email protected]/dist/calc.bundle.js"></script>
<script>
calc(3).add(5); //returns 8
</script>
Using npm:
npm -i --save @perreh/js-calculator
In Node.js
var calc = require('@perreh/js-calculator');
calc(3).add(5); //returns 8
Take a copy of the code if you want to make changes or build the bundle yourself. eslint is used in the build to test code against a style guide.
git clone https://github.com/perryjsteward/js-calculator.git
cd js-calculator
npm install
npm build
build will bundle the file into /dist
Test the package using Jasmine against original index.js:
npm run test
To test a specific spec file (-- --
is not a typo):
npm test -- --filter="Calculator Minus"
- Perry Steward - Initial work - PerryJames
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details