putainde-cookie

    1.0.0 • Public • Published

    Cookie

    browser support

    Nom nom nom! The easy way to cook and eat cookies (yummy!) in #JavaScript.

    Install via npm

    $ npm install putainde-cookie (--save-dev)

    Usage

    cookie

    var cookie = require("cookie")

    Cookie.set(name, value[, opts])

    cookie.set("my-own-cookie", "nom nom nom", {
      domain: ".wonderland.com",
      path: "/foo",
      expires: +new Date() + (Cookie.DAY * 4)
    });
     
    var expires = new Date();
    expires.setTime(expires.getTime() + 8 * Cookie.DAY);
    cookie.set("my-own-cookie", "nom nom nom", expires);
    cookie.set("my-own-cookie", "nom nom nom");

    Cookie.get(name)

    cookie.get("my-own-cookie"); // 'nom nom nom'

    Cookie.remove(name[, opts])

    // bye-bye!
    Cookie.remove("my-own-cookie");
    Cookie.remove("my-own-cookie", {
      domain: ".wonderland.com",
      path: "/foo"
    });

    Sugar!

    Cookie fits well with the excellent lib moment.js.

    First of all, install moment:

    $ bower install moment

    Now, you can use something like this:

    // Cookie should be eaten before the end of the day
    Cookie.set("gingerbread", "excellent", {
      expires: moment().endOf('day')
    });

    Attribution

    Cookie designed by Caroline Lancaster from The Noun Project.

    Keywords

    none

    Install

    npm i putainde-cookie

    DownloadsWeekly Downloads

    6

    Version

    1.0.0

    License

    none

    Last publish

    Collaborators

    • bloodyowl