Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

0.0.3 - removed amd wrapper

  • Loading branch information...
commit 8b6a133358d320daa1528d019afaea27c0a461ea 1 parent 25134dd
@jgallen23 jgallen23 authored
View
4 build.json
@@ -3,9 +3,7 @@
"DIST_DIR": "./dist",
"monster": [
"./lib/copyright.js",
- "./lib/amd-top.js",
- "./lib/monster.js",
- "./lib/amd-bottom.js"
+ "./lib/monster.js"
]
},
"JSHINT_OPTS": {
View
99 dist/monster.js
@@ -1,65 +1,54 @@
/*!
* Cookie Monster - A javascript cookie library
- * v0.0.2
+ * v0.0.3
* https://github.com/jgallen23/cookie-monster
* copyright JGA 2011
* MIT License
*/
-!function (name, definition) {
- if (typeof module != 'undefined' && module.exports) module.exports = definition();
- else if (typeof define == 'function' && typeof define.amd == 'object') define(definition);
- else this[name] = definition();
-}('monster', function() {
-
-var monster = function() {
- return {
- set: function(name, value, days, path) {
- var date = new Date(),
- expires = '',
- type = typeof(value),
- valueToUse = '';
- path = path || "/";
- if (days) {
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
- expires = "; expires=" + date.toGMTString();
- }
- if(type !== "string" && type !== "undefined"){
- if(!("JSON" in window)) throw "Bummer, your browser doesn't support JSON parsing.";
- valueToUse = JSON.stringify({v:value});
- }
- else
- valueToUse = escape(value);
-
- document.cookie = name + "=" + valueToUse + expires + "; path=" + path;
- },
- get: function(name) {
- var nameEQ = name + "=",
- ca = document.cookie.split(';'),
- value = '',
- firstChar = '',
- parsed={};
- for (var i = 0; i < ca.length; i++) {
- var c = ca[i];
- while (c.charAt(0) == ' ') c = c.substring(1, c.length);
- if (c.indexOf(nameEQ) === 0) {
- value = c.substring(nameEQ.length, c.length);
- firstChar = value.substring(0, 1);
- if(firstChar=="{"){
- parsed = JSON.parse(value);
- if("v" in parsed) return parsed.v;
- }
- if(value=="undefined") return undefined;
- return unescape(value);
+var monster = {
+ set: function(name, value, days, path) {
+ var date = new Date(),
+ expires = '',
+ type = typeof(value),
+ valueToUse = '';
+ path = path || "/";
+ if (days) {
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
+ expires = "; expires=" + date.toGMTString();
+ }
+ if(type === "object" && type !== "undefined"){
+ if(!("JSON" in window)) throw "Bummer, your browser doesn't support JSON parsing.";
+ valueToUse = JSON.stringify({v:value});
+ }
+ else
+ valueToUse = escape(value);
+
+ document.cookie = name + "=" + valueToUse + expires + "; path=" + path;
+ },
+ get: function(name) {
+ var nameEQ = name + "=",
+ ca = document.cookie.split(';'),
+ value = '',
+ firstChar = '',
+ parsed={};
+ for (var i = 0; i < ca.length; i++) {
+ var c = ca[i];
+ while (c.charAt(0) == ' ') c = c.substring(1, c.length);
+ if (c.indexOf(nameEQ) === 0) {
+ value = c.substring(nameEQ.length, c.length);
+ firstChar = value.substring(0, 1);
+ if(firstChar=="{"){
+ parsed = JSON.parse(value);
+ if("v" in parsed) return parsed.v;
}
+ if(value=="undefined") return undefined;
+ return unescape(value);
}
- return null;
- },
- remove: function(name) {
- this.set(name, "", -1);
}
- };
-}();
-
- return monster;
-});
+ return null;
+ },
+ remove: function(name) {
+ this.set(name, "", -1);
+ }
+};
View
4 dist/monster.min.js
@@ -1,8 +1,8 @@
/*!
* Cookie Monster - A javascript cookie library
- * v0.0.2
+ * v0.0.3
* https://github.com/jgallen23/cookie-monster
* copyright JGA 2011
* MIT License
*/
-!function(a,b){typeof module!="undefined"&&module.exports?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):this[a]=b()}("monster",function(){var a=function(){return{set:function(a,b,c,d){var e=new Date,f="",g=typeof b,h="";d=d||"/",c&&(e.setTime(e.getTime()+c*24*60*60*1e3),f="; expires="+e.toGMTString());if(g!=="string"&&g!=="undefined")if("JSON"in window)h=JSON.stringify({v:b});else throw"Bummer, your browser doesn't support JSON parsing.";else h=escape(b);document.cookie=a+"="+h+f+"; path="+d},get:function(a){var b=a+"=",c=document.cookie.split(";"),d="",e="",f={};for(var g=0;g<c.length;g++){var h=c[g];while(h.charAt(0)==" ")h=h.substring(1,h.length);if(h.indexOf(b)===0){d=h.substring(b.length,h.length),e=d.substring(0,1);if(e=="{"){f=JSON.parse(d);if("v"in f)return f.v}return d=="undefined"?undefined:unescape(d)}}return null},remove:function(a){this.set(a,"",-1)}}}();return a})
+var monster={set:function(a,b,c,d){var e=new Date,f="",g=typeof b,h="";d=d||"/",c&&(e.setTime(e.getTime()+c*24*60*60*1e3),f="; expires="+e.toGMTString());if(g==="object"&&g!=="undefined")if("JSON"in window)h=JSON.stringify({v:b});else throw"Bummer, your browser doesn't support JSON parsing.";else h=escape(b);document.cookie=a+"="+h+f+"; path="+d},get:function(a){var b=a+"=",c=document.cookie.split(";"),d="",e="",f={};for(var g=0;g<c.length;g++){var h=c[g];while(h.charAt(0)==" ")h=h.substring(1,h.length);if(h.indexOf(b)===0){d=h.substring(b.length,h.length),e=d.substring(0,1);if(e=="{"){f=JSON.parse(d);if("v"in f)return f.v}return d=="undefined"?undefined:unescape(d)}}return null},remove:function(a){this.set(a,"",-1)}}
View
2  lib/amd-bottom.js
@@ -1,2 +0,0 @@
- return monster;
-});
View
5 lib/amd-top.js
@@ -1,5 +0,0 @@
-!function (name, definition) {
- if (typeof module != 'undefined' && module.exports) module.exports = definition();
- else if (typeof define == 'function' && typeof define.amd == 'object') define(definition);
- else this[name] = definition();
-}('monster', function() {
View
2  lib/copyright.js
@@ -1,6 +1,6 @@
/*!
* Cookie Monster - A javascript cookie library
- * v0.0.2
+ * v0.0.3
* https://github.com/jgallen23/cookie-monster
* copyright JGA 2011
* MIT License
View
88 lib/monster.js
@@ -1,48 +1,46 @@
-var monster = function() {
- return {
- set: function(name, value, days, path) {
- var date = new Date(),
- expires = '',
- type = typeof(value),
- valueToUse = '';
- path = path || "/";
- if (days) {
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
- expires = "; expires=" + date.toGMTString();
- }
- if(type === "object" && type !== "undefined"){
- if(!("JSON" in window)) throw "Bummer, your browser doesn't support JSON parsing.";
- valueToUse = JSON.stringify({v:value});
- }
- else
- valueToUse = escape(value);
-
- document.cookie = name + "=" + valueToUse + expires + "; path=" + path;
- },
- get: function(name) {
- var nameEQ = name + "=",
- ca = document.cookie.split(';'),
- value = '',
- firstChar = '',
- parsed={};
- for (var i = 0; i < ca.length; i++) {
- var c = ca[i];
- while (c.charAt(0) == ' ') c = c.substring(1, c.length);
- if (c.indexOf(nameEQ) === 0) {
- value = c.substring(nameEQ.length, c.length);
- firstChar = value.substring(0, 1);
- if(firstChar=="{"){
- parsed = JSON.parse(value);
- if("v" in parsed) return parsed.v;
- }
- if(value=="undefined") return undefined;
- return unescape(value);
+var monster = {
+ set: function(name, value, days, path) {
+ var date = new Date(),
+ expires = '',
+ type = typeof(value),
+ valueToUse = '';
+ path = path || "/";
+ if (days) {
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
+ expires = "; expires=" + date.toGMTString();
+ }
+ if(type === "object" && type !== "undefined"){
+ if(!("JSON" in window)) throw "Bummer, your browser doesn't support JSON parsing.";
+ valueToUse = JSON.stringify({v:value});
+ }
+ else
+ valueToUse = escape(value);
+
+ document.cookie = name + "=" + valueToUse + expires + "; path=" + path;
+ },
+ get: function(name) {
+ var nameEQ = name + "=",
+ ca = document.cookie.split(';'),
+ value = '',
+ firstChar = '',
+ parsed={};
+ for (var i = 0; i < ca.length; i++) {
+ var c = ca[i];
+ while (c.charAt(0) == ' ') c = c.substring(1, c.length);
+ if (c.indexOf(nameEQ) === 0) {
+ value = c.substring(nameEQ.length, c.length);
+ firstChar = value.substring(0, 1);
+ if(firstChar=="{"){
+ parsed = JSON.parse(value);
+ if("v" in parsed) return parsed.v;
}
+ if(value=="undefined") return undefined;
+ return unescape(value);
}
- return null;
- },
- remove: function(name) {
- this.set(name, "", -1);
}
- };
-}();
+ return null;
+ },
+ remove: function(name) {
+ this.set(name, "", -1);
+ }
+};
View
2  package.json
@@ -1,7 +1,7 @@
{
"name": "cookie-monster",
"description": "a simple cookie library",
- "version": "0.0.2",
+ "version": "0.0.3",
"homepage": "https://github.com/jgallen23/cookie-monster",
"author": "Greg Allen <@jgaui> (http://jga.me)",
"repository": {
View
2  test/index.html
@@ -7,7 +7,7 @@
<script src="../node_modules/chai/chai.js"></script>
<script>mocha.setup('bdd')</script>
<script type="text/javascript" src="live.js"></script>
- <script type="text/javascript" src="../lib/monster.js"></script>
+ <script type="text/javascript" src="../dist/monster.js"></script>
<script type="text/javascript" src="monster.test.js"></script>
<style>
#fixture { display: none; }
Please sign in to comment.
Something went wrong with that request. Please try again.