Loading ...
Sorry, an error occurred while loading the content.
 

Re: For in filter

Expand Messages
  • spence.randall@ymail.com
    The Tolerate unfiltered forin is off by default, so you would want to check the appropriate box in Options or add /*jslint forin: true */, then you will no
    Message 1 of 6 , Mar 9, 2011
      The "Tolerate unfiltered forin" is off by default, so you would want to check the appropriate box in Options or add /*jslint forin: true */, then you will no longer receive the warning.

      - Randall

      --- In jslint_com@yahoogroups.com, "Ezequiel" <thehungerforce@...> wrote:
      >
      >
      > --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@> wrote:
      > >
      > > --- In jslint_com@yahoogroups.com, "Ezequiel" <thehungerforce@> wrote:
      > > >
      > > > Because I'm using my own function for the if statement, this doesn't work:
      > > >
      > > > example:
      > > >
      > > > var isOwnProperty, object, i;
      > > >
      > > > isOwnProperty = function(object, key) {....};
      > > >
      > > > object = {zero: 0};
      > > >
      > > > for (i in object) {
      > > > if (isOwnProperty(object, i)) {
      > > > ...
      > > > }
      > > > }
      > > >
      > > > However, it works if my if statement was something like... object.hasOwnProperty(i);
      > >
      > >
      > > You turned on the forin option. You can not do that.
      > >
      >
      > No, I did not have any options turned on when I ran that snippet.
      >
    • Ezequiel
      I don t want to tolerate unfiltered forins, though.
      Message 2 of 6 , Mar 20, 2011
        I don't want to tolerate unfiltered forins, though.

        --- In jslint_com@yahoogroups.com, "spence.randall@..." <randall@...> wrote:
        >
        >
        >
        >
        >
        >
        > The "Tolerate unfiltered forin" is off by default, so you would want to check the appropriate box in Options or add /*jslint forin: true */, then you will no longer receive the warning.
        >
        > - Randall
        >
        > --- In jslint_com@yahoogroups.com, "Ezequiel" <thehungerforce@> wrote:
        > >
        > >
        > > --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@> wrote:
        > > >
        > > > --- In jslint_com@yahoogroups.com, "Ezequiel" <thehungerforce@> wrote:
        > > > >
        > > > > Because I'm using my own function for the if statement, this doesn't work:
        > > > >
        > > > > example:
        > > > >
        > > > > var isOwnProperty, object, i;
        > > > >
        > > > > isOwnProperty = function(object, key) {....};
        > > > >
        > > > > object = {zero: 0};
        > > > >
        > > > > for (i in object) {
        > > > > if (isOwnProperty(object, i)) {
        > > > > ...
        > > > > }
        > > > > }
        > > > >
        > > > > However, it works if my if statement was something like... object.hasOwnProperty(i);
        > > >
        > > >
        > > > You turned on the forin option. You can not do that.
        > > >
        > >
        > > No, I did not have any options turned on when I ran that snippet.
        > >
        >
      • Ezequiel
        I remember reading JSLint s source and seeing a is_own function to filter forins. Apparently, it seems Crockford has switched to actually writing
        Message 3 of 6 , Mar 20, 2011
          I remember reading JSLint's source and seeing a is_own function to filter forins.

          Apparently, it seems Crockford has switched to actually writing Object.hasOwnProperty.call out every single time and jslint followed accordingly. Okay.


          --- In jslint_com@yahoogroups.com, "Ezequiel" <thehungerforce@...> wrote:
          >
          > Because I'm using my own function for the if statement, this doesn't work:
          >
          > example:
          >
          > var isOwnProperty, object, i;
          >
          > isOwnProperty = function(object, key) {....};
          >
          > object = {zero: 0};
          >
          > for (i in object) {
          > if (isOwnProperty(object, i)) {
          > ...
          > }
          > }
          >
          > However, it works if my if statement was something like... object.hasOwnProperty(i);
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.