a zip code crypto-currency system good for red ONLY

ErrorHelpers.js 793B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const loaderFlag = "LOADER_EXECUTION";
  7. exports.cutOffLoaderExecution = (stack) => {
  8. stack = stack.split("\n");
  9. for(let i = 0; i < stack.length; i++)
  10. if(stack[i].indexOf(loaderFlag) >= 0)
  11. stack.length = i;
  12. return stack.join("\n");
  13. };
  14. exports.cutOffMessage = (stack, message) => {
  15. const nextLine = stack.indexOf("\n");
  16. if(nextLine === -1) {
  17. return stack === message ? "" : stack;
  18. } else {
  19. const firstLine = stack.substr(0, nextLine);
  20. return firstLine === message ? stack.substr(nextLine + 1) : stack;
  21. }
  22. };
  23. exports.cleanUp = (stack, message) => {
  24. stack = exports.cutOffLoaderExecution(stack);
  25. stack = exports.cutOffMessage(stack, message);
  26. return stack;
  27. };