diff options
author | Matěj Cepl <mcepl@redhat.com> | 2013-05-13 23:59:43 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2013-05-15 00:09:30 +0200 |
commit | 7f91596ca5fbe55831d587cdb746b4da595a15ff (patch) | |
tree | b624ed5b62a67a570e88b5b8a6608819d0c613f3 | |
parent | f23003947b2b34644cdedf9fd9699d8173b20ac7 (diff) | |
download | parseLDIF-7f91596ca5fbe55831d587cdb746b4da595a15ff.tar.gz |
Don't fail when the library is used from a website.
-rw-r--r-- | parseLDIF.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/parseLDIF.js b/parseLDIF.js index 3e932c1..e060f54 100644 --- a/parseLDIF.js +++ b/parseLDIF.js @@ -168,7 +168,7 @@ const usefulFields = ["birthyear", "c", "cn", "description", "mobile", "mozillaHomeCountryName", "mozillaHomeLocalityName", "mozillaHomePostalCode", "mozillaHomeState", "mozillaHomeStreet", "mozillaHomeUrl", "mozillaNickname", "o", "sn", "st", "street", - "telephoneNumber", "title", "givenname", "objectclass" + "telephoneNumber", "title", "objectclass" ]; function debug(str) { @@ -289,7 +289,7 @@ function parseLDIF(inStr) { return out_records; } -if (arguments.length == 1) { +if (arguments && arguments.length == 1) { var lines = readFile(arguments[0]).replace(/\r\n/g,"\n"); print(parseLDIF(lines.split("\n")).toSource()); } |