a zip code crypto-currency system good for red ONLY

12345678910111213141516
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. module.exports = function removeAndDo(collection, thing, action) {
  7. const idx = this[collection].indexOf(thing);
  8. const hasThingInCollection = idx >= 0;
  9. if(hasThingInCollection) {
  10. this[collection].splice(idx, 1);
  11. thing[action](this);
  12. }
  13. return hasThingInCollection;
  14. };