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: weights.every is not a function #161

Open
njzjz opened this issue Dec 13, 2022 · 4 comments
Open

TypeError: weights.every is not a function #161

njzjz opened this issue Dec 13, 2022 · 4 comments

Comments

@njzjz
Copy link

njzjz commented Dec 13, 2022

After the version was bumped from v2.0.3 to v2.1.2, I got the following error:

TypeError: weights.every is not a function
    at module.exports.drawWeights (smiles-drawer.min.js:56:216581)
    at module.exports.draw (smiles-drawer.min.js:56:208856)
    at bundle.js:2:12354
    at SmilesDrawer.parse (smiles-drawer.min.js:1:1751)
    at f (bundle.js:2:12331)
    at HTMLDivElement.<anonymous> (bundle.js:2:9746)
    at Function.each (jquery.min.js:2:3003)
    at S.fn.init.each (jquery.min.js:2:1481)
    at l (bundle.js:2:9664)
    at Object.callback (bundle.js:2:11161)

The error disappeared after reverting to the previous version. From the traceback, the error should happen here:

if (weights.every(w => w === 0)) {

@daenuprobst
Copy link
Member

Did you encounter this error in every browser or was it unique to Internet Explorer 11?

@njzjz
Copy link
Author

njzjz commented Jan 5, 2023

was it unique to Internet Explorer 11

My browser is Edge 108.0.1462.54.

@njzjz
Copy link
Author

njzjz commented Jan 5, 2023

You can take a look at my application.
v2.0.8
image

v2.1.2
image

I catch the error and make it fallback to pure texts, but the error message can still be shown in the console.

@dwrolvink
Copy link

Can confirm. This project's own example file can recreate this:
https://github.com/reymond-group/smilesDrawer/blob/master/example/index_svg.html

Changing the line:

<script src="../dist/smiles-drawer.js"></script>

To:
<script src="https://unpkg.com/smiles-drawer@2.0.3/dist/smiles-drawer.min.js"></script>

Works, while setting the version to 2.1.5 gives this error, as well as using the smiles-drawer currently in dist.

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

3 participants