bin icon indicating copy to clipboard operation
bin copied to clipboard

"Unexpected token in JSON" error

Open fernandocanizo opened this issue 4 years ago • 1 comments

Test case: https://codepen.io/fernandocanizo/pen/GRgWZmE?editors=1010

I'm having an error on library loading phase (or maybe in the get) which I cannot reproduce on linked CodePen: (behaves normal, works). But the same in my page doesn't work. it throws me:

bin.min.js:2 Uncaught SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at e.get (bin.min.js:2)
    at app.js:6

app.js:6 has either:

  • const taskList = savedTaskList.get(); or
  • const taskList = savedTaskList.get([]); (default to Array).

Tested with version 0.0.2 and latest.

Importing the library via CDN with:

<script src="https://cdn.jsdelivr.net/gh/cferdinandi/bin/dist/bin.min.js"></script>

fernandocanizo avatar Dec 19 '19 18:12 fernandocanizo

Do you want to create a local version of the file that I can download instead? Happy to take a look at the "actually causing an error" version.

cferdinandi avatar Dec 19 '19 18:12 cferdinandi