You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
527 B

2 years ago
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = stripComments;
  4. function stripComments(str) {
  5. var s = "";
  6. var commentStart = str.indexOf("/*");
  7. var lastEnd = 0;
  8. while (commentStart >= 0) {
  9. s = s + str.slice(lastEnd, commentStart);
  10. var commentEnd = str.indexOf("*/", commentStart + 2);
  11. if (commentEnd < 0) {
  12. return s;
  13. }
  14. lastEnd = commentEnd + 2;
  15. commentStart = str.indexOf("/*", lastEnd);
  16. }
  17. s = s + str.slice(lastEnd);
  18. return s;
  19. }
  20. module.exports = exports.default;