js-cookie: Cookies.getJSON is not a function

I just got your library from Bower (2.1.*) and included the JS file.

With the following code:

closedAlerts = Cookies.getJSON 'closed_alerts'

I get Cookies.getJSON is not a function error.

This code works:

closedAlerts = JSON.parse Cookies.get 'closed_alerts'

I check the vendor JS file and the getJSON is right here. Already had this issue?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@evictor

In v3 all built-in functionality related to handling json has been removed (it‘s mentioned in the release notes for the first beta).

I think this functionality was accidentally removed from library but is still documented in the README

Could you point me to where this is still documented, I can‘t seem to find it?

My bad @carhartl I was referring to old docs for v2—https://www.npmjs.com/package/js-cookie

Curious why it was removed? Security concerns?

Did you used the same version from the bower_components directory? If you did then the problem is not with js-cookie. I suggest in this case that you read sscce.org and post a question in stackoverflow with a reduced example that reproduces the problem, then certainly somebody will help you much faster. Also when a question is in stackoverflow it has a better visibility on Google for those looking the answer for the same problem in the future.

On Feb 11, 2016 12:55 AM, “Sullivan SENECHAL” notifications@github.com wrote:

@FagnerMartinsBrack Unfortynatly, I can’t reproduce on jsfiddle: https://jsfiddle.net/xnsk9a7a/

Maybe something wrong with the bower package?

— Reply to this email directly or view it on GitHub.