remote-origin-url icon indicating copy to clipboard operation
remote-origin-url copied to clipboard

fix to handle obj not having 'hasOwnProperty' function

Open adjoinant opened this issue 5 years ago • 1 comments

I encountered an issue that I believe is caused by a recent change to the ini package (upon which parse-git-config depends). The ini package introduced the use of 'Object.create(null)' to create objects. (See https://github.com/npm/ini/commit/032fbaf5f0b98fce70c8cc380e0d05177a9c9073)

This PR is to change how the existence of obj keys is performed, to handle this change in 'ini'.

adjoinant avatar Feb 11 '21 17:02 adjoinant

Hi @adjoinant, thanks for the PR!

fwiw, ini published a patch that rolled back the Object.create(null) change, so parse-git-config (and this library)` should continue to work fine.

That being said, I do think updating the check is a good idea, but I think all that's necessary is to change line 56 to:

if (Object.hasOwnProperty.call(obj, 'remote "origin"')) {

This keeps the logic the same (e.g. Object.keys is only done if 'remote "origin"' is not a property).

I encountered an issue that I believe is caused by a recent change to the ini package

If you think your issue might be caused by something else, please feel free to open another issue with additional information so someone can help track down the root cause.

doowb avatar Feb 20 '21 14:02 doowb