mikemaccana / whois-json

Whois with results in actual, structured, camelCased JavaScript!
61 stars 34 forks source link

fix json replacing repetitive duplicate value #4

Closed d30jeff closed 7 years ago

d30jeff commented 7 years ago

Hi, please have a look if this is okay for you.

We basically changed:

var keyName = changeCase.camelCase(lineParts[0]);
                result[keyName] = lineParts.splice(1).join(':').trim();

To:

if ( !(keyName in result) )
                  result[keyName] = [];
                result[keyName].push(lineParts.splice(1).join(':').trim());

Thanks

mikemaccana commented 7 years ago

Thanks Jeff! Will publish shortly.

mikemaccana commented 7 years ago

AFAICT the pull request turns every result into an array:

-  "techStreet": [
-    "2400 E. Bayshore Pkwy"
-  ]
-  "updatedDate": [
-    "2015-06-12T10:38:52-0700"
-  ]
-  "urlOfTheIcannWhoisDataProblemReportingSystem": [
-    "http://wdprs.internic.net/"
-  ]
d30jeff commented 7 years ago

Hi Mike,

I'm really sorry for breaking the current code and was not able to fix it as soon as possible.

I'll review and test my code before requesting any merge request to ensure it's not breaking anything in the future.

Lesson was learned, and again, I am sorry.