move loop to function

This commit is contained in:
AJ ONeal 2014-06-17 20:11:50 -06:00
parent 3cad559617
commit 6539f8a153

View File

@ -74,18 +74,17 @@ function parseBody(current, lines) {
function parseCertData(lines) { function parseCertData(lines) {
var certs = [] var certs = []
, line
, current , current
, skipped = 0 , skipped = 0
, match , match
, finished , finished
; ;
while (lines.length > 0) { function parseLine(line) {
line = lines.shift();
// nuke whitespace and comments // nuke whitespace and comments
if (line.match(/^#|^\s*$/)) continue; if (line.match(/^#|^\s*$/)) {
return;
}
if (line.match(/^CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE/)) { if (line.match(/^CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE/)) {
current = new Certificate(); current = new Certificate();
@ -110,6 +109,10 @@ function parseCertData(lines) {
} }
} }
while (lines.length > 0) {
parseLine(lines.shift());
}
console.info("Skipped %s untrusted certificates.", skipped); console.info("Skipped %s untrusted certificates.", skipped);
console.info("Processed %s certificates.", certs.length); console.info("Processed %s certificates.", certs.length);