Lines Matching refs:name
32 * Checks the validity of a cookie name.
34 function validateCookieName(name){
35 if (!isString(name) || name === ""){
36 error("Cookie name must be a non-empty string.");
41 * Checks the validity of a subcookie name.
45 error("Subcookie name must be a non-empty string.");
62 * @param {String} name The name of the cookie.
71 _createCookieString : function (name /*:String*/, value /*:Variant*/, encodeValue /*:Boolean*/, options /*:Object*/) /*:String*/ {
75 var text /*:String*/ = encode(name) + "=" + (encodeValue ? encode(value) : value),
177 //check for normally-formatted cookie (name-value)
220 * Determines if the cookie with the given name exists. This is useful for
221 * Boolean cookies (those that do not follow the name=value convention).
222 * @param {String} name The name of the cookie to check.
227 exists: function(name) {
229 validateCookieName(name); //throws error
233 return cookies.hasOwnProperty(name);
237 * Returns the cookie value for the given name.
238 * @param {String} name The name of the cookie to retrieve.
251 get : function (name, options) {
253 validateCookieName(name); //throws error
270 cookie = cookies[name];
286 * @param {String} name The name of the cookie to retrieve.
287 * @param {String} subName The name of the subcookie to retrieve.
297 getSub : function (name /*:String*/, subName /*:String*/, converter /*:Function*/) /*:Variant*/ {
299 var hash /*:Variant*/ = this.getSubs(name);
321 * Returns an object containing name-value pairs stored in the cookie with the given name.
322 * @param {String} name The name of the cookie to retrieve.
323 * @return {Object} An object of name-value pairs if the cookie with the given name
328 getSubs : function (name) {
330 validateCookieName(name); //throws error
333 if (isString(cookies[name])){
334 return this._parseCookieHash(cookies[name]);
342 * @param {String} name The name of the cookie to remove.
351 remove : function (name, options) {
353 validateCookieName(name); //throws error
361 return this.set(name, "", options);
365 * Removes a sub cookie with a given name.
366 * @param {String} name The name of the cookie in which the subcookie exists.
367 * @param {String} subName The name of the subcookie to remove.
376 removeSub : function(name, subName, options) {
378 validateCookieName(name); //throws error
385 var subs = this.getSubs(name);
394 return this.setSubs(name, subs, options);
399 return this.setSubs(name, subs, options);
403 return this.remove(name, options);
412 * Sets a cookie with a given name and value.
413 * @param {String} name The name of the cookie to set.
423 set : function (name, value, options) {
425 validateCookieName(name); //throws error
433 var text = this._createCookieString(name, value, !options.raw, options);
439 * Sets a sub cookie with a given name to a particular value.
440 * @param {String} name The name of the cookie to set.
441 * @param {String} subName The name of the subcookie to set.
450 setSub : function (name, subName, value, options) {
452 validateCookieName(name); //throws error
460 var hash = this.getSubs(name);
468 return this.setSubs(name, hash, options);
473 * Sets a cookie with a given name to contain a hash of name-value pairs.
474 * @param {String} name The name of the cookie to set.
475 * @param {Object} value An object containing name-value pairs.
483 setSubs : function (name, value, options) {
485 validateCookieName(name); //throws error
491 var text /*:String*/ = this._createCookieString(name, this._createCookieHashString(value), false, options);