Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created March 15, 2019 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongorman/e4188ffcb6f81883761e80b0be8357e9 to your computer and use it in GitHub Desktop.
Save jasongorman/e4188ffcb6f81883761e80b0be8357e9 to your computer and use it in GitHub Desktop.
const debit = (account, amount) => {
if(amount > account.balance + account.limit){
throw "Insufficient funds error";
}
return {...account, balance: account.balance - amount};
}
module.exports = debit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment