1/** 2 * Copyright © Magento, Inc. All rights reserved. 3 * See COPYING.txt for license details. 4 */ 5 6define([ 7 'jquery', 8 'js-cookie/js.cookie' 9], function ($, cookie) { 10 'use strict'; 11 12 window.Cookies = window.Cookies || cookie; 13 14 var config = $.cookie = function (key, value, options) { 15 if (value !== undefined) { 16 options = $.extend({}, config.defaults, options); 17 18 return cookie.set(key, value, options); 19 } 20 21 var result = key ? undefined : {}, 22 cookies = document.cookie ? document.cookie.split('; ') : [], 23 i; 24 25 for (i = 0; i < cookies.length; i++) { 26 var parts = cookies[i].split('='), 27 name = config.raw ? parts.shift() : decodeURIComponent(parts.shift()), 28 cookieValue = parts.join('='); 29 30 if (key && key === name) { 31 result = decodeURIComponent(cookieValue.replace('/\\+/g', ' ')); 32 break; 33 } 34 35 if (!key && (cookieValue = decodeURIComponent(cookieValue.replace('/\\+/g', ' '))) !== undefined) { 36 result[name] = cookieValue; 37 } 38 } 39 40 return result; 41 }; 42 43 config.defaults = {}; 44 45 $.removeCookie = function (key, options) { 46 if ($.cookie(key) === undefined) { 47 return false; 48 } 49 50 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 51 return !$.cookie(key); 52 }; 53});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.