MCPcopy Index your code
hub / github.com/totaljs/framework / minify_javascript

Function minify_javascript

internal.js:1118–1263  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

1116}
1117
1118function minify_javascript(data) {
1119
1120 var index = 0;
1121 var output = [];
1122 var isCS = false;
1123 var isCI = false;
1124 var alpha = /[0-9a-z$]/i;
1125 var white = /\W/;
1126 var skip = { '$': true, '_': true };
1127 var newlines = { '\n': 1, '\r': 1 };
1128 var regexp = false;
1129 var scope, prev, next, last;
1130 var vtmp = false;
1131 var regvar = /^(\s)*var /;
1132 var vindex = 0;
1133
1134 while (true) {
1135
1136 var c = data[index];
1137 var prev = data[index - 1];
1138 var next = data[index + 1];
1139
1140 index++;
1141
1142 if (c === undefined)
1143 break;
1144
1145 if (!scope) {
1146
1147 if (!regexp) {
1148 if (c === '/' && next === '*') {
1149 isCS = true;
1150 continue;
1151 } else if (c === '*' && next === '/') {
1152 isCS = false;
1153 index++;
1154 continue;
1155 }
1156
1157 if (isCS)
1158 continue;
1159
1160 if (c === '/' && next === '/') {
1161 isCI = true;
1162 continue;
1163 } else if (isCI && newlines[c]) {
1164 isCI = false;
1165 alpha.test(last) && output.push(' ');
1166 last = '';
1167 continue;
1168 }
1169
1170 if (isCI)
1171 continue;
1172 }
1173
1174 if (c === '\t' || newlines[c]) {
1175 if (!last || !alpha.test(last))

Callers 1

internal.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected