I use phpstorm and over the past half a year or so it started warning me about code like this:
for( let key in attachmentPaths ){
requestObject.formData.attachments.push( fs.createReadStream(attachmentPaths[key]) )
}
Warning on [key]
Possible iteration over unexpected (custom/inherited) members, probably missing hasOwnProperty check
I understand the warning message, but i don't understand how a for()
like this is bad?
Surely additional checks to ensure the key exists with the object is silly as we are looping over the objects found keys..?