Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
stripComments.js21 linesDownload Raw Back to util
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = stripComments;
5function stripComments(str) {
6  var s = "";
7  var commentStart = str.indexOf("/*");
8  var lastEnd = 0;
9  while (commentStart >= 0) {
10    s = s + str.slice(lastEnd, commentStart);
11    var commentEnd = str.indexOf("*/", commentStart + 2);
12    if (commentEnd < 0) {
13      return s;
14    }
15    lastEnd = commentEnd + 2;
16    commentStart = str.indexOf("/*", lastEnd);
17  }
18  s = s + str.slice(lastEnd);
19  return s;
20}
21module.exports = exports.default;
codekingpro/portable-devtools · Team Ai