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

Re: For in filter

Expand Messages
  • Ezequiel
    ... No, I did not have any options turned on when I ran that snippet.
    Message 1 of 6 , Mar 9 5:31 PM
    • 0 Attachment
      --- 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.
    • 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 2 of 6 , Mar 9 8:33 PM
      • 0 Attachment
        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 3 of 6 , Mar 20 10:15 AM
        • 0 Attachment
          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 4 of 6 , Mar 20 10:23 AM
          • 0 Attachment
            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.