From 6539f8a153ec8a01bf0b312069a46eb8ac669e73 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 17 Jun 2014 20:11:50 -0600 Subject: [PATCH] move loop to function --- ca-store-generator.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ca-store-generator.js b/ca-store-generator.js index ee82bc7..9094634 100644 --- a/ca-store-generator.js +++ b/ca-store-generator.js @@ -74,18 +74,17 @@ function parseBody(current, lines) { function parseCertData(lines) { var certs = [] - , line , current , skipped = 0 , match , finished ; - while (lines.length > 0) { - line = lines.shift(); - + function parseLine(line) { // nuke whitespace and comments - if (line.match(/^#|^\s*$/)) continue; + if (line.match(/^#|^\s*$/)) { + return; + } if (line.match(/^CKA_CLASS CK_OBJECT_CLASS CKO_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("Processed %s certificates.", certs.length);