Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hasOwnProperty should be called directly from prototype #12

Closed
alexandrosm opened this issue Oct 6, 2013 · 0 comments
Closed

hasOwnProperty should be called directly from prototype #12

alexandrosm opened this issue Oct 6, 2013 · 0 comments
Assignees

Comments

@alexandrosm
Copy link

While trying out harp.js, I fell onto this issue:

sintaxi/harp#101

Since the message is pretty tell-tale, a google led me to this: http://www.2ality.com/2012/01/objects-as-maps.html

Without knowing too much about the terraform codebase, I modified isEmpty in terraform/lib/helpers/raw.js to be as follows:

var isEmpty = function(obj) {
  for(var prop in obj) {
    if(Object.prototype.hasOwnProperty.call(obj,prop))
      return false;
  }
  return true;
}

This caused the error to change into something more informative. The change I made should not have changed the behaviour, but my form is more resistant to problems, so I'm letting you guys know in case you want to correct it throughout your codebase.

@ghost ghost assigned sintaxi Oct 11, 2013
@sintaxi sintaxi closed this as completed Oct 11, 2013
echaozh pushed a commit to echaozh/terraform that referenced this issue Oct 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants