cookies.js

Languages and libraries

browser cookie library

SHOW HN2016

cookies.js

cookies.js, making cookies a delight to work with on the front-end

github.com

#javascript cookies#front-end cookies#cookie library#browser cookies

122points
46comments
#293of 2,264 in 2016
Top 13%of 2016 by points

How HN took it

RoastedHalf or more of the comments are critical

1 positive, 4 neutral or asking, 1 mixed, 6 critical, out of 12 comments about the project. Thread score -0.28.

Design: 1 for, 2 againstIdea: 0 for, 2 againstExecution: 0 for, 2 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Simple, prefer the API over alternatives

    From 2 comments
    • Unlike izolate, I prefer your API. Great Library!
      Fifer82 on HN
    • Is preference not a valid reason? :) Other reason: the syntax is more explicit, and already familiar to anybody who has used Maps [1] I find your syntax a little confusing. It's…
      izolate on HN
  • Sensible defaults and easy options

    From 1 comment
    • That was totally my original meaning; sensible defaults, easy options and just a simple function to work with makes me want to keep using a library all day. So I try to follow…
      franciscop on HN

Objections

  • Syntax is confusing, e.g. setting multiple cookies with different options

    From 1 comment
    • Is preference not a valid reason? :) Other reason: the syntax is more explicit, and already familiar to anybody who has used Maps [1] I find your syntax a little confusing. It's…
      izolate on HN
  • Cookie name encoding does not follow RFC token rules

    From 2 comments
    • Cool submission! Per RFC 6265, which is the cookie spec you seem to use, the valid chars for cookie names is defined [1] by RFC 2616 (since obsoleted by the 723x series; but…
      niftich on HN
    • I did more research and have a further follow-up. According to MDN [1], encodeURIComponent escapes all characters except the following: ``` alphabetic, decimal digits, - _ . ! ~…
      niftich on HN
  • Options object style seems unusual to some

    From 1 comment
    • This feels so wrong.... ``` cookies({ token: '42' }, { expires: 100 * 24 * 3600, // The time to expire in seconds domain: false, // The domain for the cookie path: '/', // The…
      abimaelmartell on HN

Requests

  • Add a WebStorage adapter

    From 1 comment
    • It would be interesting if you adapted this to use the WebStorage api. https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API
      keeperofdakeys on HN
  • Add more examples to the readme

    From 1 comment
    • It is totally a valid reason, that's what I wanted to say with fair enough (: I see, you could just call the same function few times with different options (preferred) as…
      franciscop on HN
  • Drop Bower support and promote npm

    From 1 comment
    • Good work, but I prefer the syntax of cookies-js [1] Side note, Bower is a dying package manager. You'd get better results if you promoted the npm link over bower. [1]…
      izolate on HN

Questions

  • How does it compare to Express cookie-parser?

    From 1 comment
    • How does this compare to Express's cookie parser (https://github.com/expressjs/cookie-parser) which relies on cookie (https://github.com/jshttp/cookie) for parsing?
      yefim on HN
  • Why is the library needed at all, and how is it different from js-cookie?

    From 2 comments
    • This reminds me of jquery-cookie which was replaced by js-cookie. https://github.com/js-cookie/js-cookie
      brian_herman on HN
    • Someone already mentioned js-cookie [0], but they didn't mention that it supports legacy browsers! If you're tied down supporting old IE, it's a great choice. I've used both…
      TheAceOfHearts on HN

Alternatives named

  • js-cookie

    From 3 comments
    • This reminds me of jquery-cookie which was replaced by js-cookie. https://github.com/js-cookie/js-cookie
      brian_herman on HN
    • Someone already mentioned js-cookie [0], but they didn't mention that it supports legacy browsers! If you're tied down supporting old IE, it's a great choice. I've used both…
      TheAceOfHearts on HN
    • Congrats on shipping it! This got me thinking about what the existing cookie libraries looked like in npm, since I figured it was a solved problem already, potentially even with…
      ianstormtaylor on HN
  • cookies-js

    From 2 comments
    • Good work, but I prefer the syntax of cookies-js [1] Side note, Bower is a dying package manager. You'd get better results if you promoted the npm link over bower. [1]…
      izolate on HN
    • Someone already mentioned js-cookie [0], but they didn't mention that it supports legacy browsers! If you're tied down supporting old IE, it's a great choice. I've used both…
      TheAceOfHearts on HN
  • Express cookie-parser

    From 1 comment
    • How does this compare to Express's cookie parser (https://github.com/expressjs/cookie-parser) which relies on cookie (https://github.com/jshttp/cookie) for parsing?
      yefim on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/12450684)