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

TypeError: Object ; has no method 'contains' #66

Closed
chemerisuk opened this issue Nov 22, 2014 · 14 comments
Closed

TypeError: Object ; has no method 'contains' #66

chemerisuk opened this issue Nov 22, 2014 · 14 comments

Comments

@chemerisuk
Copy link

Noticed that the latest version fails to process immediately invoked function with "use strict" on the top:

(function() {
  "use strict";
  ...
}());

with error:

TypeError: Object ; has no method 'contains'.

Just FYI I'm using the project in scope of gulp-es6-transpiler.

@chemerisuk
Copy link
Author

I believe the problem here is that you use String#contains that does not exist in ES5.

@chemerisuk
Copy link
Author

Submitted PR #67 with the fix. Please merge it asap

@nicoolas25
Copy link

+1

1 similar comment
@kobezzza
Copy link

+1

@nicoolas25
Copy link

What about the node version you're using?

I have this error with version 0.10.33. I'm thinking about using version 0.11.14 since it seems to support things like --harmony_strings.

@chemerisuk
Copy link
Author

@nicoolas25 well, it will work on 0.11 I guess, but there are some environments where this version can't be used (yet), because it's not stable.

@chemerisuk
Copy link
Author

BTW recently String#contains was renamed to String#includes, so the first one is non-standard now. Details here: https://github.com/tc39/Array.prototype.includes#status

@maranomynet
Copy link

+1

@maranomynet
Copy link

.contains() has been part of transpiler/RegExp.js since March 2014, but only got added to transpiler/core.js last August.

@chemerisuk
Copy link
Author

Alright, the real cause of the problem is paulmillr/es6-shim@226517d that the transpiler uses as a dependency. It explains why we started to have this error only recently.

Not sure if the project is maintained at present, but I found a workaround. You can fix es6-shim to the robust version in your package.json and add install script that removes the dependency from es6-transpiler. In such case the project will use parent version of es6-shim that we specified above. Check example here chemerisuk/better-dom-boilerplate@3f24123

@maranomynet
Copy link

Err, shouldn't es6-transpiler simply upgrade to use .includes() instead of .contains() ? That sounds like the simplest fix.

@nicoolas25
Copy link

Yep, it should and the author will probably update this soon. In the meantime, we have the @chemerisuk workarround.

@monolithed
Copy link

[Fixed] 4e22924

@chemerisuk
Copy link
Author

I can confirm, it works in 0.7.18. Therefore my workaround can be removed.

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

5 participants