Permalink
Browse files

documentation and browserify as a dev dep

  • Loading branch information...
1 parent def1196 commit c275342f7fca59815688ffdab448d8327319866d @substack committed Sep 28, 2011
Showing with 53 additions and 2 deletions.
  1. +50 −2 README.markdown
  2. +3 −0 package.json
View
@@ -1,4 +1,52 @@
cookie-cutter
--------------
+=============
-Set and get cookies in the browser.
+Set and get cookies in the browser or in node with `document`.
+
+In your browser code with [browserify](github.com/substack/node-browserify):
+
+````javascript
+var cookie = require('cookie-cutter');
+var times = parseInt(cookie.get('times'), 10) || 0;
+cookie.set('times', times + 1);
+````
+
+and `times` will increment every time the page is reloaded.
+
+methods
+=======
+
+````javascript
+var cookie = require('cookie-cutter');
+````
+
+cookie(document)
+----------------
+
+Return a new cookie object with `.get()` and `.set()` operating on `document`.
+
+`document.cookie` should be a non-referentially transparent setter/getter combo
+like the DOM's variant where assignment with optional path and expiry creates a
+new cookie in the getter as a key=value pair.
+
+cookie.get(key)
+---------------
+
+Return the cookie value for `key`.
+
+cookie.set(key, value, opts={})
+-------------------------------
+
+Set the cookie at `key` to `value` with optional parameters `expiry` and `path`.
+
+install
+=======
+
+With [npm](http://npmjs.org) do:
+
+ npm install cookie-cutter
+
+license
+=======
+
+MIT/X11
View
@@ -15,6 +15,9 @@
"directories" : {
"lib" : "."
},
+ "devDependencies" : {
+ "browserify" : "1.5.x"
+ },
"license" : "MIT",
"author" : {
"name" : "James Halliday",

0 comments on commit c275342

Please sign in to comment.