1.2.0 • Published 8 years ago

change-maker v1.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

change-maker

Circle CI

Coverage Status Dependency status Dependency status npm version Known Vulnerabilities

Change Maker is a simple general purpose implementation of the 'change making' problem, this module has been created to talk candidates through a greedy (but memoised and sideffectless) implementation of this classic knapsack problem.

## Usage

npm install change-maker
const makeChange = require('change-maker');

// Where the first argument is a string representing the amount and the second is the array of coin denominations
const change = makeChange('$2.34', [100, 50, 25, 10, 5, 1]); // { '100': 2, '50': 0, '25': 1, '10': 0, '5': 1, '1': 4 }

## Testing

npm test
npm coverage // runs tests and generates coverage report

Contrubuting

All contributors will abide by the CODE_OF_CONDUCT.md.

License

MIT