News for hackers. Stuff that matters.
Re:Show HN: cookies.js, making cookies a delight to work wit... by abimaelmartell on Thursday September 08, 2016 @01:54PM (#12455365)
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 path for the cookie
      secure: https ? true : false  // Require the use of https
    });
Re:Show HN: cookies.js, making cookies a delight to work wit... by SamBam on Thursday September 08, 2016 @02:47PM (#12456001)
Why? It looks pretty standard to me. It uses named variables for options, instead of argument position, and has reasonable defaults, so you don't have to specify every option.

This is the standard, modern way of added options to a function.

Re:Show HN: cookies.js, making cookies a delight to work wit... by niftich on Thursday September 08, 2016 @02:06PM (#12455492)
Can you elaborate? Is it the DSL-like syntax for setting cookies that's strange? Or?

I actually quite like it because you can manipulate each portion of the string separetely, vs.

  token: 42; expires: 8640000; path=/; secure