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

Compiling React.js source results in an error #96

Open
alahtarin opened this issue Aug 25, 2015 · 0 comments
Open

Compiling React.js source results in an error #96

alahtarin opened this issue Aug 25, 2015 · 0 comments

Comments

@alahtarin
Copy link

React.js has a following function:

function hasArrayNature(obj) {
  return (
    // not null/false
    !!obj &&
    // arrays are objects, NodeLists are functions in Safari
    (typeof obj == 'object' || typeof obj == 'function') &&
    // quacks like an array
    ('length' in obj) &&
    // not window
    !('setInterval' in obj) &&
    // no DOM node should be considered an array-like
    // a 'select' element has 'length' and 'item' properties on IE8
    (typeof obj.nodeType != 'number') &&
    (
      // a real array
      (// HTMLCollection/NodeList
      (Array.isArray(obj) ||
      // arguments
      ('callee' in obj) || 'item' in obj))
    )
  );
}

After compiling, it results into the following code:

function hasArrayNature(obj) {
  return // not null/false
  !!obj && (typeof obj == 'object' || typeof obj == 'function') && 'length' in obj && // not window
  !('setInterval' in obj) && typeof obj.nodeType != 'number' && (Array.isArray(obj) || 'callee' in obj || 'item' in obj);
}

So in all the situations this function returns undefined

I dealt with it by passing to admclean

'esprima': {
   'comment': false
 }

I don't know if this is a bug in Esprima or in Amdclean, anyway I guess it should be fixed.

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

1 participant