<jga.me/>

Fork me on GitHub

Cookie Monster - A cookie library for javascript

10/20/2011

In my previous projects, whenever I needed to add cookie support, I would copy and paste the same three functions over and over again. Now that I've been using ender for all my dependency management, I'm able to stop my copy and pasting and start building out some standalone modules.

Cookie Monster is a very simple library that has only three methods: set, get and remove. All are pretty self explanatory. Here is the usage and example:

Usage:

monster.set(name, value, days, path) //days and path are optional
monster.get(name)
monster.remove(name)

Example:

//set a cookie named 'cookiename' to '123' for 1 day
monster.set('cookiename', '123', 1);
//set val to '123'
var val = monster.get('cookiename');
//remove it
monster.remove('cookiename');

Ender:

ender build cookie-monster 

Download

Dev | Prod | Github

Any thoughts?
blog comments powered by Disqus

Categories

Recent Posts