Closed edolix closed 6 years ago
Seems that Symbol.iterator
is undefined
- that's what the error says.
It's not supposed to be undefined
.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator
You can check that by manually editing the js file in node_modules by adding a console.log.
Perhaps your ES6 Symbol polyfill is not complete: Symbol
seems to be defined but seems that it's not the ES6 Symbol
.
You can try using import 'babel-polyfill'
or something like that (as the first line of your program).
Or, actually, my previous comment was incorrect: the Symbol
polyfill seems fine but text[Symbol.iterator]
is undefined
for some reason.
@catamphetamine thanks for the quick reply!
Symbol.iterator
is equal to '@@iterator'
, text
is a string (the input number) so: '8 (800) 555 35 35'
.
Is the package updated on npm
?
Yeah, seems that you're not in a full ES6 environment. Are you using Babel?
Is the package updated on npm?
What do you mean?
Yeah, seems that you're not in a full ES6 environment. Are you using Babel?
I'm on ReactNative but it seems that Symbol
are not fully supported by RN.
Well, I could look into a way of polyfilling symbol iterator somehow. I'll post if I find something.
I found a workaround here https://github.com/facebook/react-native/issues/15902#issuecomment-375521246. It seems to work!
@edolix Yeah, that's one way to do it, and actually it's better in a sense that other libraries relying on Symbol don't break.
The other thing is that I found a way to bypass Symbol.iterator
in the code and released a new version libphonenumber-js@1.1.6
. If you feel like trying it out (while temporarily reverting your core-js
fix) then you could do that. Otherwise your present workaround seems fine.
CC @sachinB94 @m-hosoi ^^^^^^^
If you feel like trying it out ....
SUPER! I'll try it tomorrow for sure 👍
@catamphetamine thanks again for your help!
@catamphetamine v1.1.6
works without any workaround! Thanks!
Hi, i'm using this lib in a ReactNative App and methods
parse
andformat
catch this error:How i'm using lib:
Installed from:
npm install libphonenumber-js
I'm doing something wrong? Thanks!