var ipRegex = require('ip-port-regex');
...
for(var i = 0; i < orgArrayWithHostsAndPorts.length; i++) {
ipPort = ipRegex.parts(orgArrayWithHostsAndPorts[i]);
console.log(ipPort);
/*
Gives long listing
{ ip: 'firstip', port: 'firstport' }
{ ip: 'secondip', port: 'secondport' }
*/
fs.writeFileSync('/tmp/test.json', JSON.stringify(ipPort, null, 2), 'utf-8');
}
So when I do fs.writeFileSync
I see only the first object. What I really want is to property save every ip/port as set of the separate objects in the array. I can't add ,
to every object