aboutsummaryrefslogtreecommitdiffstats
path: root/parseLDIF.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2013-05-23 08:05:00 +0200
committerMatěj Cepl <mcepl@redhat.com>2013-05-23 08:47:19 +0200
commitccd8b64dbb18e19f3129f74429ac83b99c295734 (patch)
tree3cbf09732d0309abd07bfdcd50537e68b93fc290 /parseLDIF.js
parent7f91596ca5fbe55831d587cdb746b4da595a15ff (diff)
downloadparseLDIF-ccd8b64dbb18e19f3129f74429ac83b99c295734.tar.gz
Switch testing to NodeJS, so we can use Travis-CI.
Also remove all dependencies on Rhino.
Diffstat (limited to 'parseLDIF.js')
-rw-r--r--parseLDIF.js17
1 files changed, 11 insertions, 6 deletions
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;
}