From ccd8b64dbb18e19f3129f74429ac83b99c295734 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 23 May 2013 08:05:00 +0200 Subject: Switch testing to NodeJS, so we can use Travis-CI. Also remove all dependencies on Rhino. --- parseLDIF.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'parseLDIF.js') diff --git a/parseLDIF.js b/parseLDIF.js index e060f54..a79cb11 100644 --- a/parseLDIF.js +++ b/parseLDIF.js @@ -163,17 +163,24 @@ var Base64 = { } +// RFC 2849 uses givenname, RFC 4519 uses givenName, we rather support +// both const usefulFields = ["birthyear", "c", "cn", "description", "facsimiletelephonenumber", "givenName", "homePhone", "l", "mail", "mobile", "mozillaHomeCountryName", "mozillaHomeLocalityName", "mozillaHomePostalCode", "mozillaHomeState", "mozillaHomeStreet", "mozillaHomeUrl", "mozillaNickname", "o", "sn", "st", "street", - "telephoneNumber", "title", "objectclass" + "telephoneNumber", "title", "objectclass", "givenname" ]; function debug(str) { if (debugState) { - print(str); + if (console) { + console.log(str); + } + else { + print(str); + } } } @@ -188,7 +195,6 @@ function debug(str) { * - doesn’t even consider change requests, only complete values * - doesn’t include version: field (seems to be ignored by * Thunderbird as well). - * - ignores multi-value attributes completely * - ignores < links */ function parseLDIF(inStr) { @@ -289,7 +295,6 @@ function parseLDIF(inStr) { return out_records; } -if (arguments && arguments.length == 1) { - var lines = readFile(arguments[0]).replace(/\r\n/g,"\n"); - print(parseLDIF(lines.split("\n")).toSource()); +if (exports) { + exports.parseLDIF = parseLDIF; } -- cgit